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 Björn Häuser <bj...@gmail.com> on 2013/03/24 02:03:10 UTC

FOP Trunk - URI Resolution

Hi,

thank you all for patience and work for Apache FOP.

I recently switched to the trunk version to get support for table-markers! This is so nice! Thank you all!

With the switch came some problems regarding image path resolution, it stopped working (for me) with hopefully the same configuration as I used on 1.1.

This is my directory structure:
src/main/java/foo/bar/document.java -> thats the one which initializes fop
src/main/resources/templates/foo.xsl -> base .xsl file
src/main/resources/templates/images/image.png -> the image

What I want is that in the *.XSL files all images are referenced by images/image.png, the extra "images/" is fine for me.

What I tried is:
FopFactoryBuilder fopFactoryBuilder = new FopFactoryBuilder(new URI("classpath:src/main/resources/templates/"));
fopFactory = fopFactoryBuilder.build();

But this gives me this exception:
Caused by: java.lang.IllegalArgumentException: URI is not absolute
    at java.net.URI.toURL(URI.java:1095)
    at org.apache.fop.apps.io.ResourceResolverFactory$NormalResourceResolver.getResource(ResourceResolverFactory.java:188)

I truncated the rest of the Stacktrace.

What do I need to configure for that working in that way?

Thanks in advance
Björn



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


Re: FOP Trunk - URI Resolution

Posted by Luis Bernardo <lm...@gmail.com>.
Try something like this:

String confFile = "/path/to/fop.xconf";
FopFactoryBuilder builder = new FopConfParser(new 
File(confFile)).getFopFactoryBuilder();

On 3/24/13 1:03 AM, Björn Häuser wrote:
> Hi,
>
> thank you all for patience and work for Apache FOP.
>
> I recently switched to the trunk version to get support for table-markers! This is so nice! Thank you all!
>
> With the switch came some problems regarding image path resolution, it stopped working (for me) with hopefully the same configuration as I used on 1.1.
>
> This is my directory structure:
> src/main/java/foo/bar/document.java -> thats the one which initializes fop
> src/main/resources/templates/foo.xsl -> base .xsl file
> src/main/resources/templates/images/image.png -> the image
>
> What I want is that in the *.XSL files all images are referenced by images/image.png, the extra "images/" is fine for me.
>
> What I tried is:
> FopFactoryBuilder fopFactoryBuilder = new FopFactoryBuilder(new URI("classpath:src/main/resources/templates/"));
> fopFactory = fopFactoryBuilder.build();
>
> But this gives me this exception:
> Caused by: java.lang.IllegalArgumentException: URI is not absolute
>      at java.net.URI.toURL(URI.java:1095)
>      at org.apache.fop.apps.io.ResourceResolverFactory$NormalResourceResolver.getResource(ResourceResolverFactory.java:188)
>
> I truncated the rest of the Stacktrace.
>
> What do I need to configure for that working in that way?
>
> Thanks in advance
> Björn
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
>


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