Search code examples
javaeclipsepdfjarapache-fop

Images are not displayed in PDF generated by apache fop


I am generating PDF files with the apache fop library (v2.2). If I run application from the Eclipse IDE all run without problems but if I generate JAR from the Eclipse IDE with library handling set to Extract required libraries into generated JAR and after that I will run JAR it will generate PDF files without images (text is visible as expected). First I thought that it is caused by invalid file paths, but If I use the base64 encoding of images directly in the XSL images are still not visible. If I generate JAR with library handling set to Package required libraries into generated JAR everything run OK but too slowly. Have you any idea which can be the reason of this?


Solution

  • I found out following problems:

    1. I was using my java.util.logging.Logger and did not see the results of the logger used in apache fop. I build simple testing application without this logger and got following error:

    'SEVERE: Image not available. URI: image_name.jpg. Reason: org.apache.xmlgraphics.image.loader.ImageException: The file format is not supported. No ImagePreloader found for image_name.jpg(No context info available)'

    1. Description how to solve this problem for application build with maven is here. I am using external JARs, so I only changed the order of adding JARs in Java Build Path menu in Eclipse and eveything works.

    enter image description here