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

Free Support Forum - aspose.com

Sequence Page numbers while merging two PDF Document

I am using aspose.pdf for creating PDF documents. I need to merger two PDF files. Issue is the merged file (second one) is restarting page numbers. For example.
1st PDF had 3 pages and 2nd PDF had 6 pages so merged PDF is showing like 1-3 and then 1-6. I want it to show like 1-9.

I tried. PDF.pages.ADD() for adding both PDF to new PDF.
Also tried pdfDocument1.getPages().add(pdfDocument2.getPages()); but did not work.

Please help!

1 Like


Could you please share your sample PDF documents with us. We will test the scenario in our environment and address it accordingly.

Hi Asad, Please find attached PDFs.Sample2.pdf (101.7 KB)
Sample1.pdf (86.2 KB)


Thanks for sharing sample files.

We have tested the scenario in our environment and observed the page number sequence issue. Please note that page numbers are added at the time of PDF generation and once PDF document is saved, they become part of content. In other words, they cannot be detected as separate entity or resource but as text. It is highly unlike that page numbers can be manipulated unless they were added as stamp or annotation.

Nevertheless, we have logged an investigation ticket as PDFNET-46110 in our issue tracking system for the sake of detailed investigation. As soon as we have some definite updates regarding its resolution, we will surely inform you. Please be patient and spare us little time.