Page 1 of 1

Use another library with docx4j

PostPosted: Thu Oct 23, 2014 2:51 pm
by javasol
Is there a way to use docx4j to convert a docx and then use another library (iText,Fop) to convert to pdf? This will give me the flexibility of using docx4j plus the full features of the other library. The way I'm thinking is to use docx4j to convert to xml or maybe Html and then use itext or fop to convert to pdf

Re: Use another library with docx4j

PostPosted: Thu Oct 23, 2014 8:21 pm
by jason
Well, docx4j already uses FOP to convert to PDF. You can look at the source code to see how it is done; one approach uses XSLT, the other does it without XSLT. But in both cases docx4j creates FO, then uses FOP to create the PDF.

There is unmaintained basic code for using iText; see https://github.com/plutext/docx4j/tree/ ... f/viaIText

Similarly, via HTML; see https://github.com/plutext/docx4j/blob/ ... rsion.java (you'll want to update it to use the current HTML code)