pdfbox-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tilman Hausherr (JIRA)" <j...@apache.org>
Subject [jira] [Created] (PDFBOX-4326) PDF with JPEG2000 image can't be rendered
Date Sat, 29 Sep 2018 11:44:00 GMT
Tilman Hausherr created PDFBOX-4326:

             Summary: PDF with JPEG2000 image can't be rendered
                 Key: PDFBOX-4326
                 URL: https://issues.apache.org/jira/browse/PDFBOX-4326
             Project: PDFBox
          Issue Type: Bug
          Components: Rendering
    Affects Versions: 2.0.11
            Reporter: Tilman Hausherr
            Assignee: Tilman Hausherr
             Fix For: 2.0.13, 3.0.0 PDFBox
         Attachments: PDFJS-10026.jp2, PDFJS-10026.pdf

There is an EOF exception:
    at javax.imageio.stream.ImageInputStreamImpl.readBits(ImageInputStreamImpl.java:687)
    at org.apache.pdfbox.pdmodel.graphics.image.SampledImageReader.fromAny(SampledImageReader.java:523)
    at org.apache.pdfbox.pdmodel.graphics.image.SampledImageReader.getRGBImage(SampledImageReader.java:217)
    at org.apache.pdfbox.pdmodel.graphics.image.PDImageXObject.getImage(PDImageXObject.java:418)
    at org.apache.pdfbox.pdmodel.graphics.image.PDImageXObject.getImage(PDImageXObject.java:400)
    at org.apache.pdfbox.rendering.PageDrawer.drawImage(PageDrawer.java:1021) 
The EOF exception is because SampledImageReader expects a stream that is 3x longer than actually
appears, because the colorspace is said to have 3 colors instead of 1. This is because the
plugin returns an image with IndexColorModel which references three colors.

There are two ways to solve this and both worked: the slower is to convert to RGB which requires
another change when reading the raster (because the raster is now made if intergers), the
faster is to force a gray colorspace. I use the later but keep the change I made in passing
the raster, we may need it some day.

I'm making the change only for the trunk for now, and to the 2.0 branch after release of 2.0.12.

This message was sent by Atlassian JIRA

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

View raw message