The default URIReader doesn't know how to handle the ServletContext paths. I had a similar issue where embedded font URL's and external graphics were not being found under the webapp.
Jeremias Mearki added another URIResolver called ServletContextURIResolver to the trunk http://svn.apache.org/viewcvs?rev=379810&view=rev Which lets you specify URI's like "servlet-context:/path/from/servlet/context/myImage.gif" you just need to add it to the FOUserAgent while configuring your FOP, Like: ServletContext context= .....; InputSource fopconfigInputSource = new InputSource(..blah blah ..); //Set up stuff from fop config file if it exists if(this.fopconfigInputSource!=null) { DefaultConfigurationBuilder cfgBuilder = new DefaultConfigurationBuilder(); Configuration cfg = cfgBuilder.build(this.fopconfigInputSource); //If ServletContext is not null then setup ServletContextURIReader(context); if(context!=null) { URIResolver uriResolver = new ServletContextURIResolver(context); userAgent.setURIResolver(uriResolver); } this.userAgent.setUserConfig(cfg); Fop fop = new Fop(MimeConstants.MIME_PDF,this.userAgent); //...etc....etc } This works as is for images, but the URIResolver passed in isn't used throughout FOP yet, and so embedded font URL's read from the fop config fail. I wrote a work around (see this thread: http://marc.theaimsgroup.com/?l=fop-user&m=114099192412561&w=2 and http://marc.theaimsgroup.com/?l=fop-user&m=114099649120178&w=2 ) that does use the URIResolver and so you can specify font URL's in fopconfig.xml like: <renderers> <renderer mime="application/pdf"> <filterList> <value>flate</value> </filterList> <fonts> <font metrics-url="servlet-context:///WEB-INF/Arial.xml" kerning="no"> <font-triplet name="Arial" style="normal" weight="normal"/> <font-triplet name="ArialMT" style="normal" weight="normal"/> </font> <font metrics-url="servlet-context:///WEB-INF/ArialBd.xml" kerning="no"> <font-triplet name="Arial" style="normal" weight="bold"/> <font-triplet name="ArialMT" style="normal" weight="bold"/> </font> </fonts> </renderer> </renderers> Which allows you to package all external images and font metrics with your webapp. The work around isn't in trunk yet (perhaps because I've not submitted it as a patch yet), but hopefully soon Cheers Karl -----Original Message----- From: John Wiberg [mailto:[EMAIL PROTECTED] Sent: Thursday, 16 March 2006 11:13 AM To: fop-users@xmlgraphics.apache.org Subject: Setting fop 0.91 to know relative path. I have a java class that runs fop. It looks like it handles relative paths just fine when run directly from the OS command prompt but when I call the class from a web application running under tomcat, it looks like it is using the path from where I started tomcat. Any ideas? Thanks, John -- View this message in context: http://www.nabble.com/Setting-fop-0.91-to-know-relative-path.-t1288332.h tml#a3427422 Sent from the FOP - Users forum at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] NOTICE This e-mail and any attachments are confidential and may contain copyright material of Macquarie Bank or third parties. If you are not the intended recipient of this email you should not read, print, re-transmit, store or act in reliance on this e-mail or any attachments, and should destroy all copies of them. Macquarie Bank does not guarantee the integrity of any emails or any attached files. The views or opinions expressed are the author's own and may not reflect the views or opinions of Macquarie Bank. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]