I am trying to create word document programatically as mentioned below, But I am facing problem while converting the generated word document as explained below
- Code: Select all
WordprocessingMLPackage wordprocessingMLPackage = WordprocessingMLPackage.createPackage();
// Add all the data including header, footer to the document
PdfConversion conversion = new Conversion(wordMLPackage);
conversion.output(byteArrayOutputStream, new PdfSettings());
The pdf generated from above is not containing the header and footer parts and even some of the colors are not being applied on the content, And the table header that is generated in all pages of word document is not present in all pages of PDF.
Whereas after creating the word document, save it and then read it using as mentioned in the below code and then convert it to pdf it is working fine
- Code: Select all
WordprocessingMLPackage.load(new java.io.File("file path of the document generate programatically"));
What should I do to make it work even when the document is generated programatically, I am using docx4j 2.8.1 downloaded from maven central. Please help me out in resolving this issue.
Thanks