pdfbox-dev mailing list archives

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

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

ASF subversion and git services commented on PDFBOX-4326:
---------------------------------------------------------

Commit 1842325 from tilman@apache.org in branch 'pdfbox/trunk'
[ https://svn.apache.org/r1842325 ]

PDFBOX-4326: override colorspace to avoid wrong number of 3 colors; provide passing integer
RGB raster for possible future use

> 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
>            Priority: Major
>              Labels: JPEG2000, JPXDecode, JPXFilter
>             Fix For: 2.0.13, 3.0.0 PDFBox
>
>         Attachments: PDFJS-10026.jp2, PDFJS-10026.pdf
>
>
> There is an EOF exception:
> {noformat}
>     java.io.EOFException
>     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) 
> {noformat}
> 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 JPEG2000 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 of integers),
the faster is to force a gray colorspace. I use the later but keep the change I made in passing
the integer RGB 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
(v7.6.3#76005)

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


Mime
View raw message