Search code examples
xmlxsl-fo

Image not Found- XSL-FO


XSL-Fo can't retrieve my image though I've set the correct path to the image.

<fo:external-graphic src="../graphics/bullet.png" content-height="0.5cm" />

I received this error on each attempt the file was processed via Windows's command prompt.

org.apache.fop.events.LoggingEventListener processEvent
SEVERE: Image not found. URI: bullet.png. (See position 26:80)
org.apache.fop.events.LoggingEventListener processEvent                                                       
SEVERE: Image not found. URI: bullet.png. (No context info available)
org.apache.fop.events.LoggingEventListener processEvent                                                                                

The source path is the exact format provided by APACHE's FOP image example. I even executed their "image.fo" file on rendering external graphics, and still encountered the error above(with different image file).

Are there alternative solutions?


Solution

  • Relative URIs are relative to the base URI (https://xmlgraphics.apache.org/fop/fo.html#external-resources).

    If you're not setting the base URI in your FOP config, the base URI is the current directory (https://xmlgraphics.apache.org/fop/1.1/configuration.html).

    Where is the image file relative to the directory in which you're running FOP?


    Does it work when you use:

    <fo:external-graphic src="examples/fo/graphics/bullet.png" content-height="0.5cm" />
    

    ?