splitDocumentPages method
Splits the specified pages from the current document and saves them as a new document.
This function extracts the given pages from the current PDF document and saves them as a new document at the provided save path.
Parameters:
savePathThe path where the new document will be saved.pagesThe list of page indices to be extracted from the current document.
example:
var savePath = '/data/user/0/com.compdfkit.flutter.example/cache/temp/PDF_Document.pdf';
// on Android, you can use ComPDFKit.createUri() to create a Uri
var savePath = ComPDFKit.createUri('split_document.pdf');
bool splitResult = await controller.document.splitDocumentPages(savePath, [0, 1, 2]);
Implementation
Future<bool> splitDocumentPages(String savePath, List<int> pages) async {
return await _channel.invokeMethod(
'split_document_pages', {'save_path': savePath, 'pages': pages});
}