Oviic
Oviic

Reputation: 45

xsl-fo. Images not showing on PDF using xml apache graphics?

I'm new in xsl-fo. When I run my application on localhost, the images showing on my pdf. But when I deploy the application on the server the images not showing.

All images in my project are in src/main/resources/images folder. My xsl file is in src/main/resources/images/xsl folder.

All images are referenced in my xsl file by this.

  <fo:block margin-left="40mm" margin-right="2mm"
            margin-bottom="5mm">
            <fo:external-graphic                             
            src="url(file:src/main/resources/images/Image10.jpg)"
            content-width="scale-down-to-fit" content-height="scale-down-to-fit"
            scaling="uniform" />
   </fo:block>

Can some guides me how to resolve this.

Upvotes: 0

Views: 1228

Answers (1)

Tony Graham
Tony Graham

Reputation: 8068

src/main/resources/images/Image10.jpg is being located relative to the FO file (or relative to what you told the XSL Formatter to use as the base directory, or relative to an xml:base value).

Is there a src/main/resources/images directory on the server located relative to the FO file, if you run FOP on a file, or located relative to FOP's base directory if the FO doesn't exist as a file when you run FOP?

See https://xmlgraphics.apache.org/fop/faq.html#graphic-not-displayed

Upvotes: 1

Related Questions