We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Page Number in Footer of Document is Changed after DOCX to PDF Conversion using .NET

Hello,
so I have a problem with pdf converted from docx not preserving its original page number (more appropriately section number) in footer. The third section of my document (page 7) starts with 4 instead of 1 even though the original document has it marked as page 1. I’ve attached said document below (most of the contents are removed for confidentiality, but header/footer are preserved). no other modification is done other than saving the file to pdf. any help would be much appreciated, thanks.

Code used to save to stream (C#):
doc.Save(outStream, SaveFormat.Pdf)

example.docx (170.5 KB)

Edit: so I tried to save it back to docx, and page number are preserved just fine. is this a bug? if so, then is there any way to temporarily fix this issue from my end? thanks

@velb

We have tested the scenario and have not found any issue with output PDF. Please note that Aspose.Words mimics the behavior of MS Word. If you convert your document to PDF using MS Word, you will get the same output.

after couple hours of tinkering, I’ve found the issue. It’s not aspose’s fault, it’s the document user uses. It’s a problem with second section break that causes aspose to follow the page number of the second section for the ‘supposedly’ third section

please delete this topic since the problem’s root is not aspose, thank you

@velb

Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.