flattenAllPages method

Future<bool> flattenAllPages(
  1. String savePath,
  2. bool fontSubset
)

Flatten all pages of the current document.

savePath is the path to save the flattened document. On Android, you can pass a Uri.

fontSubset determines whether to include the font subset when saving.

Example:

final savePath = 'file:///storage/emulated/0/Download/flatten.pdf';
// or use a Uri on Android:
final savePath = await ComPDFKit.createUri('flatten_test.pdf', 'compdfkit', 'application/pdf');
final fontSubset = true;
final result = await controller.document.flattenAllPages(savePath, fontSubset);

Returns true if the flattened document is saved successfully, otherwise false.

Implementation

Future<bool> flattenAllPages(String savePath, bool fontSubset) async {
  return await _channel.invokeMethod('flatten_all_pages',
      {'save_path': savePath, 'font_subset': fontSubset});
}