You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Graeme Wellington <gr...@ptbuildingsolutions.com.au.INVALID> on 2024/10/15 00:20:17 UTC
Apache FOP Servlet example: images.fo - fo:external-graphic: accessing external images using http / https
Hi
I have loaded FOP into Tomcat server [everything is running locally on my Windows 10 PC].
I am trying to troubleshoot an issue using the fo:external-graphic tag in images.fo.
I have added the following to Tomcat > conf > server.xml:
<Context docBase="C:/Tomcat9/webapps/graphics/" reloadable="true" path="graphics"></Context>
This allows images to be accessed from the browser:
http://localhost:8080/graphics/linux.bmp
The browser URI to create the PDF from images.fo is:
http://localhost:8080/fop/?fo=C:/fop-2.9/fop/examples/fo/basic/images.fo
In images.fo I can get an image successfully using direct access using file:
<fo:external-graphic src=file:///C:/fop-2.9/fop-servlet/src/main/webapp/WEB-INF/graphics/xml_feather.gif/>
Using the following does not crash the session but gives an error in the log that the image was not found:
<fo:external-graphic src="url('graphics/linux.bmp')"/>
If I try using http the session crashed and I get HTTP Status 500 - Internal Server Error
<fo:external-graphic src=http://localhost:8080/graphics/linux.bmp/>
This URL works ok directly in the browser:
http://localhost:8080/graphics/linux.bmp
I have also tried external demo site which also does not work:
https://sampleurl.com/test.jpg?w=l&d=standard
https://upload.wikimedia.org/wikipedia/commons/b/bc/Apache_FOP_logo.png
Can anybody offer some direction please.
Thank in advance.
[cid:image001.jpg@01DB1EEB.BD1CA300]