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 Seamus O'Brien <se...@hotmail.com> on 2006/10/18 15:52:21 UTC
fopFactory.setFontBaseURL("") relative path problem for Tomcat
Hello,
I'm using FOP 0.92beta and am trying to get PDF generator happening within
a servlet (everything is fine in DOS). I have put all my FOP stuff into a
folder "webroot/xsl-fop". I can get the PDF generation to work if I hardcode
the paths for the FopFactory as follows:
fopFactory.setUserConfig(new File("d:/myapp/webroot/xsl-fop/fop.xconf"));
fopFactory.setFontBaseURL("file:///d:/myapp/webroot/xsl-fop/");
But I clearly don't want to do it this way for a war file, I want to use
relative paths, but I can't seem to be able to configure it.The first part
works:
fopFactory.setUserConfig(getServletContext().getRealPath("/xsl-fop/fop.xconf"));
but this doesn't:
fopFactory.setFontBaseURL("/xsl-fop");
Can anyone tell me where I'm going wrong. It must be a simple paths problem
for URL parameter (I've always had difficulties with Tomcat and relative
paths!) I can see in the logs:
INFO - base set to: file:/D:/eclipse321/./
ERROR - Error with base URL "/xsl-fop/"): no protocol: /xsl-fop/
(clearly the base is set incorrectly)
Also, I am not clear why I have to specify the path to the font.xml file
twice, once in the fop.xconf file as follows:
...
<renderers>
<renderer mime="application/pdf">
<filterList>
<value>flate</value>
</filterList>
<fonts>
<font metrics-url="verdana.xml" kerning="yes">
<font-triplet name="Verdana" style="normal" weight="normal"/>
</font>
and again for fopFactory.setFontBaseURL().
Thanks in advance,
sham
_________________________________________________________________
Find accommodation FAST with MSN Search! http://search.msn.ie/
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
Re: fopFactory.setFontBaseURL("") relative path problem for Tomcat
Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
Karl Roberts has described quite nicely what what you need. Read on at
http://www.nabble.com/RE%3A-Setting-fop-0.91-to-know-relative-path.-tf1334785.html#a3566172
Note to self: At some point I have to add this to the website....
On 18.10.2006 15:52:21 Seamus O'Brien wrote:
> Hello,
> I'm using FOP 0.92beta and am trying to get PDF generator happening within
> a servlet (everything is fine in DOS). I have put all my FOP stuff into a
> folder "webroot/xsl-fop". I can get the PDF generation to work if I hardcode
> the paths for the FopFactory as follows:
>
> fopFactory.setUserConfig(new File("d:/myapp/webroot/xsl-fop/fop.xconf"));
> fopFactory.setFontBaseURL("file:///d:/myapp/webroot/xsl-fop/");
>
> But I clearly don't want to do it this way for a war file, I want to use
> relative paths, but I can't seem to be able to configure it.The first part
> works:
>
> fopFactory.setUserConfig(getServletContext().getRealPath("/xsl-fop/fop.xconf"));
>
> but this doesn't:
>
> fopFactory.setFontBaseURL("/xsl-fop");
>
> Can anyone tell me where I'm going wrong. It must be a simple paths problem
> for URL parameter (I've always had difficulties with Tomcat and relative
> paths!) I can see in the logs:
> INFO - base set to: file:/D:/eclipse321/./
> ERROR - Error with base URL "/xsl-fop/"): no protocol: /xsl-fop/
> (clearly the base is set incorrectly)
>
> Also, I am not clear why I have to specify the path to the font.xml file
> twice, once in the fop.xconf file as follows:
> ...
> <renderers>
> <renderer mime="application/pdf">
> <filterList>
> <value>flate</value>
> </filterList>
> <fonts>
> <font metrics-url="verdana.xml" kerning="yes">
> <font-triplet name="Verdana" style="normal" weight="normal"/>
> </font>
>
> and again for fopFactory.setFontBaseURL().
>
> Thanks in advance,
> sham
Jeremias Maerki
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org