Hi,
We tried docx to pdf rendition using the below code and we can see when creating a PDF rendition based on the source Docx file on page 59 and 60 we see that the footer is incorrect. It lists “Attachment E” when it should have changed to “Attachment F”.
I have attached both input and output files below. files.zip (2.5 MB)
com.aspose.words.Document doc = new com.aspose.words.Document("test.docx");
doc.save("output.pdf");
It seems that you are experiencing an issue with the footer content not matching between your original DOCX file and the generated PDF. Specifically, the footer on pages 59 and 60 is displaying “Attachment E” instead of “Attachment F”.
To address this issue, you may want to ensure that the footer content is correctly set up in your DOCX file. Aspose.Words allows for detailed manipulation of headers and footers, including the ability to specify different content for various sections or pages.
Here are a few steps you can take to troubleshoot and potentially resolve the issue:
Check Footer Settings: Ensure that the footer for the specific pages is correctly defined in your DOCX file. You can use the Aspose.Words API to verify and modify footer content if necessary.
Use DocumentBuilder: If you need to programmatically set the footer content, consider using the DocumentBuilder class. This allows you to navigate to the footer section and set the desired text. Here’s a simple example of how to set a footer:
Document doc = new Document("test.docx");
DocumentBuilder builder = new DocumentBuilder(doc);
builder.moveToHeaderFooter(HeaderFooterType.FOOTER_PRIMARY);
builder.write("Attachment F"); // Set the desired footer text
doc.save("output.pdf");
Different Headers/Footers for Sections: If your document has multiple sections, ensure that the footer settings are applied to each section as needed. You can specify different headers and footers for odd and even pages or for the first page of a section.
Review the Original Document: Sometimes, the issue may stem from how the original DOCX file is structured. Open the DOCX file in a word processor to confirm that the footer content is as expected.
If the problem persists after checking these aspects, consider sharing more details about the structure of your DOCX file or any specific settings you are using in your code.
For more information on styling headers and footers using Aspose.Words, you can refer to the detailed guide available in the documentation.
@rnara As I can see you are using 24.8 version of Aspose.Words. I tested conversion using the latest 24.12 version of Aspose.Words for Java and the problem is not reproducible. Here is the produced output: out_java.pdf (1.1 MB)
So, please, try using the latest version of Aspose.Words on your side and let us know if the problem still persists.