I use Docx4J.toFO to convert docx to png, it's fine when the original content is single page except is a bit slow.
It show the warning:"No filename information available. Stopping early after the first page." when I convert more pages, and only one page content is generated. I don't know how to provide filename information. I am really new to docx2j.
The second question is how can I improve the speed of export.
I use one cpu core on centos7 machine, it takes about 3 seconds to export one page content.
My code is very simple like the follows:
- Code: Select all
WordprocessingMLPackage wordMLPackage = WordprocessingMLPackage.load(new java.io.File(from));
FieldUpdater updater = new FieldUpdater(wordMLPackage);
updater.update(true);
wordMLPackage.setFontMapper(fontMapper);
OutputStream os = new FileOutputStream(to);
FOSettings settings = Docx4J.createFOSettings();
settings.setWmlPackage(wordMLPackage);
settings.setApacheFopMime("image/png");
Docx4J.toFO(settings, os, Docx4J.FLAG_NONE);
Thanks in advance for help