On this page
Guides
Merge Pages
The steps to merge pages are as follows:
- Create a blank PDF document.
- Open the PDF document containing the pages to be merged.
- Select all the pages to be merged and combine them into the same document.
This example shows how to merge pages:
java
CPDFDocument documentForMerge = CPDFDocument.createDocument();
CPDFDocument document1 = new CPDFDocument();
document1.open(pdfFile);
CPDFDocument document2 = new CPDFDocument();
document2.open(pdfFile);
documentForMerge.importPages(document1, 0, document1.getPageCount() - 1, document.getPageCount());
documentForMerge.importPages(document2, 0, document2.getPageCount() - 1, document.getPageCount());