Page 1 of 1

multiple Page export about toFo feature

PostPosted: Mon Jan 11, 2016 12:47 pm
by qihuagao
Hello, first to thank you guy, Docx2j is a very awesome artifact.
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

Re: multiple Page export about toFo feature

PostPosted: Mon Jan 11, 2016 4:36 pm
by jason
Never seen that before.

Seems like it might come from http://svn.eu.apache.org/repos/asf/xmlg ... ducer.java

I'm guessing it is because you have:

Code: Select all
settings.setApacheFopMime("image/png");


Try leaving that out.

Regarding performance/speed, you can make the FO converter a bit quicker by using the NON XSLT option, but beyond that, a whole new approach is necessary. This is one of the reasons we've developed the commercial PDF Converter.

Re: multiple Page export about toFo feature

PostPosted: Mon Jan 11, 2016 9:06 pm
by qihuagao
Thank you for reply.
It's fine when comment out png stuff, but I really want to export png. any idea to solve this?
Moreover, does commercial PDF Converter support converting docx to png?