Hi Leigh
The pdf exporters only use the temp dir because the following parameter is passed into the XSLT:
- Code: Select all
String imageDirPath = System.getProperty("java.io.tmpdir");
settings.put("imageDirPath", imageDirPath);
At present, to save your HTML and associated images, you typically do something like:
- Code: Select all
OutputStream os = new java.io.FileOutputStream(inputfilepath + ".html");
javax.xml.transform.stream.StreamResult result = new javax.xml.transform.stream.StreamResult(os);
exporter.html(wordMLPackage, result, inputfilepath + "_files");
so there is nothing to stop the user from choosing to save their files to the tmpdir (which we don't want to relativise of course).
Subject to addressing this, the convention seems pretty sound. (One case to consider is where a user wants to generate both a PDF and an HTML, and for performance reasons, doesn't want to save the image twice, but I think we can defer this until someone speaks up)
We could change the signature so the user doesn't get to choose the directory for their HTML images (ie it is always inputfilepath + "_files"), or make the HTML exporters throw an exception if the user tries to use the tmpdir? Maybe we throw the exception if they try to use tmpdir, but also offer a convenience signature where they don't have to specify an image dir at all.
thanks
Jason