javaxsltapache-fop

org.apache.xmlgraphics.image.loader.ImageException: The file format is not supported. No ImagePreloader found


I am using Apache FOP 1.1(Java) to generate PDF files. It is working fine on windows machine but when I used Ubuntu machine I got this error

org.apache.xmlgraphics.image.loader.ImageException: The file format is not supported.  No ImagePreloader found

I am little bit confused. Please give me solution to sort out this problem. Thank you


Solution

  • I got solution from stackoverflow only. I am giving special thanks to author of this post Apache FOP in a Java Applet - No ImagePreloader found for data

    With reference from above post , To give precedence to XmlGraphics
    API , 
      1. I have excluded XML-graphics API from FOP jar
      2. added new maven dependency XmlGraphics API and placed above FOP dependancy
      3. so that POM will give priority
    
    
       <dependency>
            <groupId>xmlgraphics-commons</groupId>
            <artifactId>xmlgraphics-commons</artifactId>
            <version>1.4</version>
        </dependency>
    
        <dependency>
            <groupId>org.apache.xmlgraphics</groupId>
            <artifactId>fop</artifactId>
            <version>1.1</version>
            <exclusions>
                <exclusion>
                    <artifactId>xmlgraphics-commons</artifactId>
                    <groupId>org.apache.xmlgraphics</groupId>
                </exclusion>
            </exclusions>
        </dependency>
    
        <dependency>
            <groupId>org.apache.avalon.framework</groupId>
            <artifactId>avalon-framework-api</artifactId>
            <version>4.3.1</version>
        </dependency>
    
        <dependency>
            <groupId>org.apache.avalon.framework</groupId>
            <artifactId>avalon-framework-impl</artifactId>
            <version>4.3.1</version>
        </dependency>
    

    Thank you