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. Here are the steps:
Using CPDFReaderWidget:
CPDFReaderWidgetController? _controller;
// Initialize CPDFReaderWidget and get controller in onCreated callback
CPDFReaderWidget(
document: documentPath,
configuration: CPDFConfiguration(),
onCreated: (controller) {
setState(() {
this._controller = controller;
});
},
);
List<int> pagesToRemove = [0, 1, 2];
bool result = await document.removePages(pagesToRemove);Using CPDFDocument:
// Create and open the document
CPDFDocument document = await CPDFDocument.createInstance();
var error = await document.open(pdfFilePath);
if (error == CPDFDocumentError.success) {
List<int> pagesToRemove = [0, 1, 2];
bool result = await document.removePages(pagesToRemove);
}