Joseph Jezerinac created PDFBOX-5880:
----------------------------------------

             Summary: 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: Rendering
    Affects Versions: 3.0.3 PDFBox
            Reporter: Joseph Jezerinac
         Attachments: 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:702 [main] WARN DocManagerImpl - Aspose.PDF/Words license 
initialized
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