Search code examples
docx4j

How to create a PDF document with header from a template with docx4j?


I want to create a document from an existing Word 2010 document and convert it to PDF using docx4j 3.1.0. I've built upon the sample in

https://github.com/plutext/docx4j/blob/master/src/samples/docx4j/org/docx4j/samples/ConvertOutPDF.java

The Word document already contains a header with text and an image that I do not modify in my processing. The resulting PDF document, however, doesn't contain the header.

Is this someting that is supposed to work? If yes: how can I find out what I am missing?


Solution

  • Yes, if you can see the header when you "save as PDF" in Word, then you should also see the header in docx4j's PDF output.

    To have it fixed, we'll need to see the docx.