Free Support Forum - aspose.com

Aspose Pdf save as .docx removing header/footer margins

Hello, we are currently using Aspose to combine files of different types, .pdf and .docx as a couple examples, and then outputting the resulting file as a .pdf or .docx. During this process we are adding headers to the document such as page number or date. We noticed that adding the headers and footers to a docx file then outputting it to a docx looks fine , as in the header and footer margins maintain after the document is saved to local computer. However when doing the same to a Pdf the header and footer margins , more specifically the left and right margins are either removed or shrunk way down. Which in a file of combined different types causes an inconsistency in header formats. Simple console app example. Here is an example app that does the basics of what our application does. You’ll find the resulting docx in the bin/debug folder of the application. This example is not adding headers and footers but if you click into them you’ll notice that left justifying or right justifying the cursor is all the way to the left or right respectively ignoring the page margins that the text is within.

If this is a save setting that we are missing please let me know, I looked through the documentation and didn’t find anything specific to maintaining format of the saved document.

Thanks,
Kyle

@Kmjohnson74

Thank you for contacting support.

We have worked with the data shared by you but have not been able to observe the issue. As the PDF and DOCX file appear same in terms of margins on the left and right. Margins_18.5.JPG. Would you please elaborate the issue a bit more, with the help of screenshots so that we may investigate further to help you out.

We’re you able to observe if the margins in the headers and footers were maintained after being converted to a docx from pdf?AsposePdftoDoc.jpg (52.1 KB)
in this example the header margins, seems to be removed, and is outside of the body’s.

@Kmjohnson74

We are unable to notice the difference in header and footer of the documents. Would you please create a screenshot comparing the source and generated file while elaborating your concerns a little more so that we may investigate accordingly to help you out.

Our source pdf does not have the page numbers in it originally, we are adding them after converting the original file to a docx format. asposecomparison.png (96.0 KB)
We would expect the headers and footers only to go out to where the body text is. So with in the original margins of the page.I believe that somewhere in the conversion from PDF to Docx these are being lost. Here is the expected look of the page after, as well as what it looks like when the source document starts with Docx. Still with adding the header/footer using code. expected outcome.png (14.9 KB)

@Kmjohnson74

Thank you for elaborating it further.

We have been able to notice the difference. A ticket with ID PDFNET-44929 has been logged in our issue management system for further investigations. The ticket ID has been linked with this thread so that you will receive notification as soon as the ticket is resolved.

We are sorry for the inconvenience.