PDF Generation Template Editor
Open-source visual PDF generation engine with customizable templates and developer-friendly APIs.
Open-source visual PDF generation engine with customizable templates and developer-friendly APIs.
The steps to replace pages are as follows:
This example shows how to replace pages:
// Remove the first page from the document.
document.removePages(new int[]{0});
CPDFDocument document2 = new CPDFDocument(context);
document2.open(pdfPath);
// Insert the first page of another document into the original document's first-page position to complete the replacement.
document.importPages(document2, new int[]{0}, 0);// Remove the first page from the document.
document.removePages(new int[]{0})
val document2 = new CPDFDocument(context)
document2.open(pdfPath)
// Insert the first page of another document into the original document's first-page position to complete the replacement.
document.importPages(document2, intArrayOf(0), 0)When the document is bound and displayed through CPDFReaderView, after modifying the document pages, you need to call the following method to refresh the view so that the changes take effect immediately:
cpdfReaderView.reloadPages();