Section breaks inserted by Aspose.Words at the point where docs are appended is affecting page numbering only after the word doc is saved as a PDF. Page numbering no longer is based on last section but, instead, the position of the page in the entire document. Is there a workaround? It’s also an issue when a section break is necessary like adding landscape pages to portrait pages. The company I work for has been using Aspose for a year and 6 months or more have been spend trying to get around this issue because clients need the documents to have consistent page numbering.
Section breaks inserted by Aspose.Words at the point where docs are appended is affecting page numbering only after the word doc is saved as a PDF. Page numbering no longer is based on last section but, instead, the position of the page in the entire document. Is there a workaround? It’s also an issue when a section break is necessary like adding landscape pages to portrait pages. The company I work for has been using Aspose for a year and 6 months or more have been spend trying to get around this issue because clients need the documents to have consistent page numbering.
Is there a solution?
This message was posted using Aspose.Live 2 Forum
Hi
Thanks for your inquiry. Could you please attach your input and output document and provide simple code or application, which will allow reproducing the problem? I will check the issue on my side and provide you more information.
Best regards,
string srcDir = Program.SourceDir;
string targetDir = Program.DestDir;
Document testDoc = new Document(srcDir + "CoverPage.docx");
testDoc.AppendDocument(new Document(srcDir + "Section1Summary.docx"), ImportFormatMode.KeepSourceFormatting);
testDoc.AppendDocument(new Document(srcDir + "Section1Summary.docx"), ImportFormatMode.KeepSourceFormatting);
testDoc.AppendDocument(new Document(srcDir + "landscapetest.docx"), ImportFormatMode.KeepSourceFormatting);
testDoc.Save(targetDir + "doc.docx");
testDoc.SaveToPdf(targetDir + "doc.pdf");
Note that after the pdf is generated, the cover page (first doc) has no page number, the second and third pages increment (second doc) from 1 to 2, the fourth and fifth pages increment from 1 to 2 due to the section break inserted at the point the docs were merged by Aspose.Words, and the page number being set to start at 1, and the sixth page’s page number shows it’s current position in the doc (page 6) because this page was appended after the Aspose.Words generated section break and the page number was set to inherit from the previous section.
The last page should continue the page numbering from the previous doc and be 3 instead of 6.
The pages that increment from 1 to 2 are incrementing as intended.
Hi
Thank you for additional information. I cannot reproduce the problem on my side using the latest version of Aspose.Words. You can download the latest version from here:
https://releases.aspose.com/words/net
Best regards.