3

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?

JGlass
  • 1,427
  • 2
  • 12
  • 26
Michal
  • 105
  • 7
  • Possible duplicate of [Difference between extracting and packaging libraries into a jar file](https://stackoverflow.com/questions/9617420/difference-between-extracting-and-packaging-libraries-into-a-jar-file) - by the way, I've used FOP for a client - it's pretty cool! If you need further elaboration/troubleshooting I can try and help! – JGlass Jan 22 '18 at 21:44
  • 1
    Hindsight, the link provides some good information but doesnt really answer your question. You *could* always put the jars required by the app in the lib directory so they'd be accessible and it would slow your build/deploy time? – JGlass Jan 22 '18 at 21:52
  • 1
    Thank you for response, I build simple example and I got error 'SEVERE: Image not available. URI: template.JPG. Reason: org.apache.xmlgraphics.image.loader.ImageException: The file format is not supported. No ImagePreloader found for template.JPG (No context info available)'. So I think that problem is decribed here http://apache-fop.1065347.n5.nabble.com/FOP-cant-find-preloader-classes-td41075.html and https://stackoverflow.com/questions/26139301/apache-fop-in-a-java-applet-no-imagepreloader-found-for-data I will try to solve it on the evening and update current progress. – Michal Jan 22 '18 at 23:55
  • Glad you got it figured out Michal! – JGlass Jan 23 '18 at 13:37

1 Answers1

4

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

Michal
  • 105
  • 7