Question
· 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: http://base.app.mydomain.com:80/app/imgfile2016.png (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.

Thanks!

 

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

I downloaded the following Linux installation from http://www.oracle.com/technetwork/java/install-jai-imageio-1-0-01-139659...

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.

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

You just have to add the right library to fop\lib.  That is the only configuration required.

The JAI Image I/O Tools is not redistributable which is why it was not put in fop\lib.

You'll have to dig for the right JAI library to add to your lib area.  

The following link might work, but I haven't tried it.

http://www.oracle.com/technetwork/java/install-jai-imageio-1-0-01-139659...

You just have to add the right library to fop\lib.  I believe that is the only configuration required.

The JAI Image I/O Tools is not redistributable which is why it was not put in fop\lib.

You'll have to dig for the right JAI library to add to your lib area.  

The following link might work, but I haven't tried it.

http://www.oracle.com/technetwork/java/install-jai-imageio-1-0-01-139659...