No URIResolver should be necessary in this case. I think you simply need
to add "jar:" in front and it should work, i.e.:

jar:file://myapp.jar!/image.svg

On 22.07.2010 03:05:42 Bernard Giannetti wrote:
> 
> 
> 
> 
> 
> 
> I already have a URIResolver implemented to resolve the something such as
> 
>     <xsl:include href="pagesetup.xsl" />
> 
> which is what the Javadoc says it's used for:
> 
> http://download.oracle.com/docs/cd/E17409_01/javase/6/docs/api/javax/xml/transform/URIResolver.html
> 
> Unfortunately, the <fo:external-graphic src="file://myapp.jar!/image.svg" 
> content-width=8" content-height="8"> does not trigger the call to my URI 
> resolver.  I have tried src=url(....) etc with no luck.  So either I've got 
> the wrong format of the URL or it cannot be done this way.
> 
> I don't see how to use xls:include, xsl:import and document (as per the 
> Javadoc) to refer to the graphic file.  In your example, did you refer to 
> images using fo:external-graphic or using some other tag?
> 
> The other thing I noticed is I set my URIResolver on the TransformerFactory:
> 
> SAXTransformerFactory saxTransformerFactory = 
> (SAXTransformerFactory)TransformerFactory.newInstance();
> saxTransformerFactory.setURIResolver( myURIResolver );
> 
> instead of on the foUserAgent which you did...so dunno if that makes a 
> difference.
> 
> 
> > Date: Wed, 21 Jul 2010 17:16:03 +0200
> > Subject: Re: Referring to a image file in a JAR file
> > To: fop-users@xmlgraphics.apache.org
> > 
> > Hi,
> > 
> > we needed exactly that and implemented our own "ResourceResolver" for that.
> > You can register it like the following:
> > 
> > //Register a custom resolver
> > foUserAgent.setURIResolver(new ClasspathResourceResolver());
> > 
> > //The clas has to implement the URIResolver
> > public class ClasspathResourceResolver implements URIResolver {
> > 
> > //you overwrite the resolve method
> > public InputStream resolve(String uri){
> > 
> > //Resolves the path to a resource in the classpath (since that jar
> > should be in the classpath
> > this.getClass().getResourceAsStream(uri);
> > 
> > Regards,
> > ToM
>                                         
> _________________________________________________________________
> Need a new place to live? Find it on Domain.com.au
> http://clk.atdmt.com/NMN/go/157631292/direct/01/




Jeremias Maerki


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

Reply via email to