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 Nicolas <ni...@externe.bnpparibas.com> on 2008/09/09 09:43:14 UTC

Image not available

Hello,

I'm using fop 0.94.
I want to include an image that is only available through the classpath into 
the PDF, because the application is launched by java web start. The FO file 
contains a relative link to the image "image.gif", which is in the classpath. 
It has worked well like that for a while, but now I can't identify what causes 
this message : Image not available: url('image.gif').

Thanks for help.


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: Image not available

Posted by Jean-François El Fouly <je...@elfouly.fr>.
Well, As Far As I Understand It...
This *is *required and even so, it works by some kind of side-effect or 
implementation tolerance.
If I refer to the XSL FO official documentation at http://www.w3.org/TR/xsl/
what you write in url(...) is an IRI in the sense of RFC3987, and 
"relative" resource names are just not allowed there.
We had this very same problem (well, even a bit harder because the image 
files where in an "images" subdirectory) and we came to the conclusion 
that to be on the safe side, you need to build "full" URL's or fully 
qualified path names if you use the "file:" access method.
Relative URL's or relative path just wouldn't work.

Nicolas a écrit :
> Nicolas <nicolas.baumann <at> externe.bnpparibas.com> writes:
>
>   
>> Hello,
>>
>> I'm using fop 0.94.
>> I want to include an image that is only available through the classpath into 
>> the PDF, because the application is launched by java web start. The FO file 
>> contains a relative link to the image "image.gif", which is in the 
>>     
> classpath. 
>   
>> It has worked well like that for a while, but now I can't identify what 
>>     
> causes 
>   
>> this message : Image not available: url('image.gif').
>>
>> Thanks for help.
>>
>>     
>
> Hello,
>
> Adding this code solved the problem but that shouldn't be necessary and has 
> never been necessary until now :
>
> [code]
>
>       foUserAgent.setURIResolver(new URIResolver() {
>         public Source resolve(String href, String base) throws 
> TransformerException {
>           return new StreamSource(getClass().getClassLoader
> ().getResourceAsStream(href));
>         }
>       });
>
> [/code]
>
>
> Thanks for helping.
>
>
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: Image not available

Posted by Nicolas <ni...@externe.bnpparibas.com>.
Nicolas <nicolas.baumann <at> externe.bnpparibas.com> writes:

> 
> Hello,
> 
> I'm using fop 0.94.
> I want to include an image that is only available through the classpath into 
> the PDF, because the application is launched by java web start. The FO file 
> contains a relative link to the image "image.gif", which is in the 
classpath. 
> It has worked well like that for a while, but now I can't identify what 
causes 
> this message : Image not available: url('image.gif').
> 
> Thanks for help.
> 

Hello,

Adding this code solved the problem but that shouldn't be necessary and has 
never been necessary until now :

[code]

      foUserAgent.setURIResolver(new URIResolver() {
        public Source resolve(String href, String base) throws 
TransformerException {
          return new StreamSource(getClass().getClassLoader
().getResourceAsStream(href));
        }
      });

[/code]


Thanks for helping.




---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org