splitDocumentPages method

Future<bool> splitDocumentPages(
  1. String savePath,
  2. List<int> pages
)

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:

  • savePath The path where the new document will be saved.
  • pages The 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});
}