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

Andreas Lehmkühler commented on PDFBOX-5880:
--------------------------------------------

Thanks for the pointer, I'm going to look into it


> PDF render blank page: The end of the stream doesn't point to the correct 
> offset, using workaround to read the stream, stream start position: 196, 
> length: 0, expected end position: 196
> ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: PDFBOX-5880
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-5880
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Parsing
>    Affects Versions: 2.0.32, 3.0.3 PDFBox
>            Reporter: Joseph Jezerinac
>            Assignee: Andreas Lehmkühler
>            Priority: Major
>              Labels: regression
>         Attachments: PDFBOX-1094-PDFBOX-269.pdf, test.pdf
>
>
> When rendering page one of the attached PDF the image does not render.
> In the logs, I see the following:
> {noformat}
> 2024-09-24 13:25:56:924 [main] WARN COSParser - The end of the stream doesn't 
> point to the correct offset, using workaround to read the stream, stream 
> start position: 196, length: 0, expected end position: 196
> 2024-09-24 13:25:56:930 [main] WARN PDFStreamEngine - Image stream is empty
> java.io.IOException: Image stream is empty
>       at 
> org.apache.pdfbox.pdmodel.graphics.image.SampledImageReader.getRGBImage(SampledImageReader.java:182)
>       at 
> org.apache.pdfbox.pdmodel.graphics.image.PDImageXObject.getImage(PDImageXObject.java:477)
>       at 
> org.apache.pdfbox.pdmodel.graphics.image.PDImageXObject.getImage(PDImageXObject.java:438)
>       at 
> org.apache.pdfbox.rendering.PageDrawer.drawImage(PageDrawer.java:1107)
> {noformat}
> I assume this is a bad PDF, but Acrobat, Chrome, etc., display it without an 
> issue.
> Here's the render code used:
> {code:java}
> File out = File.createTempFile("test-", ".png");
> PDDocument pdDocument = Loader.loadPDF(pdf);
> final PDFRenderer pdfRenderer = new PDFRenderer(pdDocument);
> ImageIO.write(pdfRenderer.renderImageWithDPI(0, 300), "png", out);
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org
For additional commands, e-mail: dev-h...@pdfbox.apache.org

Reply via email to