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.
Swap the positions of two pages in the document. 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;
});
},
);
bool result = await document.movePage(fromIndex: 0, toIndex: 1);
if(result){
controller.reloadPages2();
}Using CPDFDocument:
// Create and open the document
CPDFDocument document = await CPDFDocument.createInstance();
var error = await document.open(pdfFilePath);
if (error == CPDFDocumentError.success) {
bool result = await document.movePage(fromIndex: 0, toIndex: 1);
}