docx4j
docx4j copied to clipboard
Some settings are not taken into account (image directory)
When redefining the image directory path, some images are still in the default directory.
WordprocessingMLPackage wordMLPackage = WordprocessingMLPackage.load(new File("/some/docxfile.docx"));
FOSettings foSettings = new FOSettings(wordMLPackage);
foSettings.setImageDirPath("/custom_temporary_directory");
foSettings.setApacheFopMime(FOSettings.INTERNAL_FO_MIME);
ByteArrayOutputStream os = new ByteArrayOutputStream();
Docx4J.toFO(foSettings, os, Docx4J.FLAG_EXPORT_PREFER_XSL);
This is caused by FOPAreaTreeHelper.java :
Document getAreaTreeViaFOP(WordprocessingMLPackage hfPkg, boolean useXSLT, FOSettings foSettingsOverall) throws Docx4JException, ParserConfigurationException, SAXException, IOException {
FOSettings foSettingsHere = Docx4J.createFOSettings();
foSettingsHere.setFopConfig(foSettingsOverall.getFopConfig());
foSettingsHere use only some of the redefined settings from foSettingsOverall. And thus use the default directory for image generation.