Derek Day · Aug 16, 2016

image/png support for Zen Reports / Apache FOP

Has anyone configured Zen Reports/FOP to support png images? If you have, could you please share the library that you used, the configuration required, and whether it was worth it (vs converting images to one of the natively supported formats)?

When changed an image to .png format in a Zen Report, the following error was returned when rendering the pdf via FOP.

java.lang.UnsupportedOperationException: No ImageHandler available for image: (image/png) (org.apache.xmlgraphics.image.loader.impl.ImageRawStream) 

From The Apache™ FOP ProjectOverview of Graphics Support, I read that there is no native support for png images, and that there is support Through Image I/O.

This tells me the following:

The image loading framework in XML Graphics Commons provides a wrapper to load images through the JDK's Image I/O API (JSR 015). Image I/O allows to dynamically add additional image codecs. An example of such an add-on library are the JAI Image I/O Tools available from Sun.



Jonathan's answer was correct, and here are the details:

I downloaded the following Linux installation from

CLASSPATH Installationjai_imageio-1_0_01-lib-linux-i586.tar.gz

From the lib subdirectory I copied *jai* to my fop/lib directory and after troubleshooting one other problem, everything is working.

The unrelated problem for the curious is as follows:
Due to some previous adhoc, I had an extra copy of the xmlgraphics-commons-1_5.jar (it had "svn" added to the filename), by starting with a clean version of the files and adding one file from my current lib at a time, I found this duplicate was causing the JAI library support to not be included. I deleted the file and left the other add-on libraries that provide other required functionality in place. It is notable and quite helpful that upgrades do not remove these libraries.

0 539
Discussion (3)0
Log in or sign up to continue

This is correct. I added some details to the top-level post for anyone else who needs the details.