The key features of the plugin are:
This ImageIO plugin is licensed under the Apache Software License 2.0. Alternatively see here.
Please take a look at the release notes.
Support is available through the Apache PDFBox community
Please choose the appropriate section below, depending on whether you need to embed the ImageIO decoder inside your application (which would, for example, be the case if you want to support shared data segments) or you just want to add JBIG2 support to an existing ImageIO-enabled application.
Using the JBIG2 plugin with an existing application that already supports Java ImageIO is - at least in theory - very simple: just plunk the plugin jar down into your classpath and you're ready to go. What, exactly, you have to do to achieve this, depends on the application in question. Unfortunately, there is no general way to add the plugin to an application. Some general recommendations:
The JBIG2 ImageIO-Plugin is available from Maven Central.
To use the plugin within a Maven POM-based project, simply include a dependency to the following artifact in the appropriate pom.xml
:
<dependency> <groupId>org.apache.pdfbox</groupId> <artifactId>jbig2-imageio</artifactId> <version>3.0.4</version> </dependency>
Several formats allow to embed JBIG2-compressed data in its own structure. PDF, for example, supports JBIG2-compressed data and adds the ability to embed shared data segments. Therefore the JBIG2ImageReader
can handle JBIG2Globals
which are stored separately and can be passed into the reader if neccessary via setGlobals()
-method.
The reader recognizes if the input data is headless and so embedded. This is assumed if the file header is missing.
You can also specify that the coming input data is embedded by using the special constructor in JBIG2ImageReader
.
ImageIO is able to scan the classpath for readers and writers. Call ImageIO.scanForPlugins()
if the reader is not seen. (Note: Thanks to George Sexton for this tip in context of using ImageIO within Apache Tomcat)