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

CAP commented on PDFBOX-4317:
-----------------------------

The stream itself and the contained data seem to be absolutely valid - 
regenerating the original Jpeg has been possible in all my experiments. The 
stream itself must therefore be "complete". However some additional PDF 
specific information might be missing from the stream, as the stream itself 
shall contain some extra information needed to identify the JPEG's progressive 
encoding. (assumption based on the reference manual)
I think that without this information Adobe Reader (and similar programs) might 
default to treating the JPEG as a baseline JPEG image (which might explain the 
failure displaying the stream).

Adobe DC is no big help in generating a "valid" progressive JPEG stream for 
comparison, as they avoid adding progressive JPEG images to PDFs altogether. 
They will convert any progressive JPEG images to baseline JPEGs (maybe to evade 
the whole problem).
For sure Adobe does not care much about adding progressive JPEG images to PDFs 
at all. According to 
*hint 5 in chapter 7.4.8:*
_"There is no benefit to using progressive JPEG for stream data that is 
embedded in a PDF file. Decoding progressive JPEG is slower and consumes more 
memory than baseline JPEG. The purpose of this feature is to enable a stream to 
refer to an external file whose data happens to be already encoded in 
progressive JPEG."_

*Adobe's standard answer:*
Adobe told the customer to ask the "creator of the PDF file" for help. They 
don't see any reason to fix it, as they are claiming, that the stream is 
incomplete and must be fixed in the producing application. Entirely possible 
and they might be correct about that - but still... Other applications are 
indeed capable of displaying the Image (/reading the erroneous stream).

> Some feature of the given JPEG leads to erroneous results, when adding 
> (drawing) it to a PDPageContentStream.
> -------------------------------------------------------------------------------------------------------------
>
>                 Key: PDFBOX-4317
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-4317
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Writing
>    Affects Versions: 2.0.9
>            Reporter: CAP
>            Priority: Major
>         Attachments: IMG-20180719-WA0000.jpg, UsingAdobeDC.pdf, 
> image-2018-09-14-09-13-56-216.png, image-2018-09-14-09-14-45-358.png, 
> image-2018-09-14-09-15-40-860.png, out.pdf
>
>
> Some feature of the given JPEG leads to erroneous results, when adding 
> (drawing) it to a PDPageContentStream.
> The document itself is created just fine and the page is displayable in the 
> "PDF Debugger" application, but for example the Adobe Reader is reporting an 
> "internal Error", when opening the created PDF.
> Reproducable via:
> {code:java}
> try(PDDocument document = new PDDocument()){
>  PDPage page = new PDPage();
>  try(PDPageContentStream pcs = new PDPageContentStream(document, page)){
>     PDImageXObject pdImage = PDImageXObject.createFromFile("path to jpeg", 
> document);
>     pcs.drawImage(pdImage, 30, 30);
>  }
>  document.addPage(page);
>  document.save(new File("output file"));
> }{code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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

Reply via email to