First it tries to load the given url directly using URL. If the url string is invalid then it tries with "file:" in front. This means that if you image url is a relative path (ie. "image.jpg") then it will find that file (automatically in java) if it is relative to the current directory. The current directory is the "user.dir" java system property which is the directory that the jvm was run in.
If this url cannot be loaded then it tries to get the file using the base directory if specified.
This is how you can specify the base directory:
String baseDir = "url path to base"; Configuration.put("baseDir", baseDir);
This will change in the future as it is static and therefore bad.
On 2002.03.13 21:10 Michael Engelhart wrote:
I have the same setup but I'm calling FOP from an embedded application (NOT a web application - no tomcat or other server).
Here's the code from my render() method:
ByteArrayOutputStream out = new ByteArrayOutputStream();
DOMResult xslFODomResult = transformPDF("/some/pathto/a/stylesheet/pdf.xsl");
Driver driver = new Driver();
driver.setRenderer(driver.RENDER_PDF);
driver.setOutputStream(out);
org.w3c.dom.Document foDoc =(org.w3c.dom.Document) xslFODomResult.getNode();
driver.render(foDoc); return (out.toByteArray());
That's why I'm trying to figure out where FOP is getting the directory path to "image.jpg" from. It doesn' t work in this situation.
Is FOP using some kind of classpath directory???