Bug 46778 - image not found
Summary: image not found
Status: CLOSED WONTFIX
Alias: None
Product: Fop - Now in Jira
Classification: Unclassified
Component: general (show other bugs)
Version: 0.95
Hardware: Other Linux
: P2 critical
Target Milestone: ---
Assignee: fop-dev
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-02-27 02:37 UTC by Thorsten Drewes
Modified: 2012-04-30 00:17 UTC (History)
2 users (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thorsten Drewes 2009-02-27 02:37:28 UTC
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
Comment 1 Jeremias Maerki 2009-02-27 07:14:28 UTC
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!
Comment 2 Dominik Stadler 2010-02-08 04:56:40 UTC
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.
Comment 3 Glenn Adams 2012-04-04 22:40:09 UTC
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
Comment 4 Glenn Adams 2012-04-30 00:14:41 UTC
batch transition resolved+wontfix to closed+wontfix
Comment 5 Glenn Adams 2012-04-30 00:17:12 UTC
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