Abstract: Seems to me that fop 0.95 (embedded) image handling is different to fop 0.94 (embedded) image handling. Details: We are using embedded fop 0.95 from the binary fop.jar in our application to generate pdf from xml via xslt. The xslt code looks like this: <fo:external-graphic border-right-style="none"> <xsl:attribute name="src"> <xsl:text>url("file:///home/abc/atxRptLogo3.jpg")</xsl:text> </xsl:attribute> </fo:external-graphic> In my code I do something like this: FOUserAgent foUserAgent = fopFactory.newFOUserAgent(); foUserAgent.setBaseURL(properties.getBaseDir("file:///"); // just to make sure I then get the fop error message: 2009-02-25 11:28:59,037 [thread-2] ERROR org.apache.fop.fo.FONode - Image not found: file:///home/abc/atxRptLogo3.jpg atxRptLogo3.jpg is in /home/abc and accessible from the permissions. Since we had no problems with a binary fop 0.94 running not embedded but standalone I compiled the fop 0.94 with jdk 1.5 and created a fop.jar and redeployed our application. *** With fop 0.94 embedded the image is found and displayed! Note: We played around with various notations of baseURL and the image url, for example: foUserAgent.setBaseURL(properties.getBaseDir("file:///home/abc"); and <xsl:text>url("file://atxRptLogo3.jpg")</xsl:text> but nothing helped
Yes, the image handling has been rewritten between 0.94 and 0.95. It should actually be much better than before and I think we've managed to meet that goal, but it could still be that there's a Gremlin hidden somewhere. In this case however, I don't know what to do. I've just tried to reproduce your case in my Ubuntu VM but that absolute file URL (including the url() wrapper) worked fine for me. Well, I did it from the command-line as I don't have a full development environment in there (I develop on WinXP). Could you also try if there's a different behaviour when run from the command-line? That could give us some hints. Anyway, I think the easiest way to identify the problem is if you can debug on your side. The best entry point is probably: org.apache.xmlgraphics.image.loader.impl.AbstractImageSessionContext.newSource() or org.apache.fop.fo.flow.ExternalGraphic.bind() Good luck!
I saw a similar issue with 0.95, I could not get FOP to find the images when I used relative pathes and the baseDir. Prepending "file:///" in the baseDir also did not have any effect. In the end I prepended the full path in the XSL-FO file to load the images correctly.
closing due lack of (1) input FO file, (2) referenced image file(s), (3) output PDF file, (4) console output; if desired, please rerun on FOP trunk and provide these files as attachments to this bug
batch transition resolved+wontfix to closed+wontfix
batch transition resolved+wontfix to closed+wontfix; if you believe this remains a bug and can demonstrate it with appropriate input FO file and output PDF file (as applicable), then you may reopen