Gábor Stefanik created PDFBOX-5872:
--------------------------------------
Summary: Support imageio-jnr / imageio-openjpeg library for
JPEG2000 decoding
Key: PDFBOX-5872
URL: https://issues.apache.org/jira/browse/PDFBOX-5872
Project: PDFBox
Issue Type: Improvement
Components: Rendering
Affects Versions: 3.0.3 PDFBox
Reporter: Gábor Stefanik
[https://github.com/dbmdz/imageio-jnr] /
[https://mvnrepository.com/artifact/de.digitalcollections.imageio/imageio-openjpeg]
is an alternative JPEG2000 implementation for Java ImageIO that uses the
native OpenJPEG library as its backend.
Unfortunately, it doesn't work out of the box because it doesn't implement
raster reading (canReadRaster not overridden, returns false), and PDFBox uses
canReadRaster() to validate image reader instances. However, it doesn't appear
that there is any real reliance on raster support in PDFBox (at least in
version 3) - if I patch the library to lie about raster support, it seems to
work perfectly.
A further complication arises when the OpenJPEG native library cannot be found:
imageio-openjpeg returns null as the reader instance, which causes PDF
rendering to fail with an NPE, even if another JPEG2000 reader is available.
This can be remedied with a simple null check.
[https://github.com/apache/pdfbox/pull/197] shows a possible solution. Until
then, [https://github.com/Googulator/imageio-jnr] can be used with PDFBox 3.0.3
as a workaround, so long as the native library is correctly installed.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]