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 Sonja Löhr <so...@arcor.de> on 2005/08/13 10:08:55 UTC
RE: Relative URLs in Servlet-created FO
Mike (and others),
I'm now very content with my configuration and will summarize it shortly:
The configuration xml is now very short:
<configuration>
<fonts>
<font metrics-file="font1.xml" kerning="yes"
embed-file="../ttf/Ss______.ttf">
<font-triplet name="customFont" style="normal" weight="normal"/>
</font>
<font metrics-file="font1_b.xml" kerning="yes"
embed-file="../ttf/Sssb____.ttf">
<font-triplet name="customFont" style="normal" weight="bold"/>
</font>
</fonts>
</configuration>
and my Servlet's init() starts with
ServletContext ctx = getServletContext();
new Options(new File(ctx.getRealPath(CONFIG_FILE)));
org.apache.fop.configuration.Configuration.put("baseDir",
ctx.getRealPath("/"));
org.apache.fop.configuration.Configuration.put("fontBaseDir",
ctx.getRealPath("/WEB-INF/fonts"));
The logo is referenced inside the stylesheet with:
<fo:external-graphic src="url(headers/logo2.svg)" />
("headers" being a directoy under the context root, "fonts" and "ttf" are
under WEB-INF)
Greetings and thanks again,
sonja
> -----Original Message-----
> From: Mike Trotman [mailto:mike.trotman@datalucid.com]
> Sent: Freitag, 12. August 2005 21:28
> To: fop-users@xmlgraphics.apache.org
> Subject: Re: Relative URLs
>
> I had some similar problems last year - but can't remember
> how I solved them.
> I have a nasty feeling that I ended up passing server names
> etc. as XSLT parameters.
>
> I also had problems between a version of XEP and FOP in their
> interpretation of url() contents - which differed.
>
> The resolution of url() paths may depend on when they are
> processed (i.e which document) and by what.
> So - the paths should be processed relative to the location
> of your FO file.
>
> If the FO file is produced in memory - then the relative base
> probably depends on the application.
> You could try using the 'xml:base' attribute on an element in
> the FO to define what should be taken as the base url for
> that element and child elements - but I haven't tried this with FOP
> - so don't know if it works / is supported.
>
> I too will be interested to see any helpful comments on this.
>
>
> Mike
>
>
>
> Sonja Löhr wrote:
>
> >
> >It's me again ...
> >All my fonts in place, I still seem to be not fit enough for
> handling
> >paths
> >;-)
> >I now try to replace an absolute URL on an external-graphic element
> >with a relative one. FO is created via XSLT, and my
> stylesheet resides
> >in a subfolder of WEB-INF. In- and OutputStreams before and
> after, but
> >that shouldn't matter.
> >"<fo:external-graphic
> >src="http://localhost:8080/pdfnewsletter/headers/logo.svg/>"
> is working
> >well here, but I cannot be sure whether the production server will
> >really be listening to "localhost".
> >What did I try?
> >a) referring to the svg in its original place outside WEB-INF with
> >url(/headers/logo.svg) - context-relative, url(headers/svg),
> >url(../../logo.svg) and so on - also with single quotes
> around the paths.
> >b) Putting the graphic (an svg) in the stylesheet's directory and
> >referring to it with "url(logo.svg)"
> >c) Putting the graphic inside the package of the
> transforming servlet,
> >which ends up in a jar file, and again referring with "url(logo.svg)"
> >
> >Some of these trials where really odd, I always tried to
> refer to the
> >execution of my servlet as "base".
> >
> >Please help once more - thanks!!
> >sonja
> >
> >
> >
> >
> >
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> >For additional commands, e-mail:
> fop-users-help@xmlgraphics.apache.org
> >
> >
> >Message Scanned by ClamAV on datalucid.com
> >
> >
> >
>
> --
> Datalucid Limited
>
>
>
>
> Message Scanned by ClamAV on datalucid.com
>
>
> ---------------------------------------------------------------------
> 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