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.
Delete specified pages from the current document. The steps to delete pages are as follows:
The following example demonstrates how to delete pages:
const pdfReaderRef = useRef<CPDFReaderView>(null);
<CPDFReaderView
ref={pdfReaderRef}
document={samplePDF}
configuration={ComPDFKit.getDefaultConfig({})}
/>
// Delete pages 1, 2, and 3 (page indices start from 0)
const deleteResult = await pdfReaderRef.current?._pdfDocument.removePages([0, 1, 2]);
if (deleteResult) {
// Refresh the page to apply the deletion effect
await pdfReaderRef.current?.reloadPages2();
}