Hi,
I am using Aspose.Words to generate PDF. I have templated in word which i finally convert to pdf.
i want to append multiple documents into a single document and finally convert that to pdf.
Say I have two documents: Document A and Document B that i want to merge.
In Document A - I am using two templates say Temp A and temp B. Document A a consists of 6 pages(Template A pages -5 pages + Template B-1 page)
In Document B - I am again using the same two templates. Document B consists of 5 pages(Template A pages- 4 pages + template B-1 page)
Now when I append these two documents into a destination document, the page numbers that i finally get are incorrect.
I tried with :
ldocbuilderSrcDocBuild.MoveToBookmark("PAGE_NUM");
ldocbuilderSrcDocBuild.Write("PAGE ");
ldocbuilderSrcDocBuild.InsertField("PAGE", null);
ldocbuilderSrcDocBuild.Write(" of ");
ldocbuilderSrcDocBuild.InsertField("NUMPAGES", null);
In this it gives me total count: like in this case it will give me Page 1 of 11… .2 of 11…11 of 11
But the Page numbering that i want is according to the document:
It should give me Page 1 of 6… Page 2 of 6… Page 6 of 6 for document A and
Page 1 of 5… Page 2of 5… page 5 of 5 for Document B within that same PDF.
Also I tried using
lpgsetPageSetup.RestartPageNumbering = true;
ldocbuilderSrcDocBuild.InsertField("SECTIONPAGES", null);
It is not working, it is giving abrupt page numbers.
Secondly I also tried with Document.PageCount
PageCount = ldocSrcDoc.PageCount;
ldocbuilderSrcDocBuild.Write(PageCount.ToString());
It is not working Either though in this case i’m getting proper page number. But when i write this Document.PageCount statement, it doesnot show me the complete PDF, it just displays the first page of PDF.
Kindly suggest how can i number the pages in my PDF.
Thanks.