[ 
https://issues.apache.org/jira/browse/PDFBOX-4763?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17030354#comment-17030354
 ] 

Tilman Hausherr commented on PDFBOX-4763:
-----------------------------------------

Code from PDStream.java:
{code:java}
public InputStream createInputStream(List<String> stopFilters) throws 
IOException
{
    InputStream is = stream.createRawInputStream();
    ByteArrayOutputStream os = new ByteArrayOutputStream();
    List<COSName> filters = getFilters();
    if (filters != null)
    {
        for (int i = 0; i < filters.size(); i++)
        {
            COSName nextFilter = filters.get(i);
            if ((stopFilters != null) && 
stopFilters.contains(nextFilter.getName()))
            {
                break;
            }
            else
            {
                Filter filter = FilterFactory.INSTANCE.getFilter(nextFilter);
                filter.decode(is, os, stream, i);
                IOUtils.closeQuietly(is);
                is = new ByteArrayInputStream(os.toByteArray());
                os.reset();
            }
        }
    }
    return is;
}{code}
I think we should just change the last line in the PDInlineImage.java method to 
"return in".

> Can't get inline image raw data
> -------------------------------
>
>                 Key: PDFBOX-4763
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-4763
>             Project: PDFBox
>          Issue Type: Bug
>          Components: PDModel
>    Affects Versions: 2.0.15
>            Reporter: Constantine Dokolas
>            Priority: Minor
>
> I'm trying to "clone" an inline image (having the original {{PDInlineImage}} 
> object) and I can't find a way to access the raw image data. The reason I 
> want the raw data is because I'm copying the dictionary as it is, including 
> the filters, and using the {{PDInlineImage}} constructor (not going via a 
> {{BufferdImage}} and {{LosslessFactory}}).
> It would seem to me that {{createInputStream(List<String> stopFilters)}} 
> should return the un-decoded stream when provided with a list blocking all 
> filters, but all it returns is an empty stream. The source code suggests that 
> {{PDImageXObject}} has the same behavior. This should not be the case. When 
> decoding is blocked, the raw data should be returned.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to