mergeMultiplePDFs method

  1. @override
Future<String?> mergeMultiplePDFs({
  1. required List<String> inputPaths,
  2. required String outputPath,
})
override

Merges multiple PDF files into a single PDF.

This method sends a request to the native platform to merge the PDF files specified in the paths parameter and saves the result in the outputPath.

Parameters:

  • inputPaths: A list of file paths of the PDFs to be merged.
  • outputPath: The directory path where the merged PDF should be saved.

Returns:

  • A Future<String?> representing the result of the operation. If the operation is successful, it returns a string message from the native platform; otherwise, it returns null.

Implementation

@override
Future<String?> mergeMultiplePDFs({
  required List<String> inputPaths,
  required String outputPath,
}) async {
  try {
    final result = await methodChannel.invokeMethod<String>(
      'mergeMultiplePDF',
      {'paths': inputPaths, 'outputDirPath': outputPath},
    );
    return result;
  } catch (e) {
    debugPrint('Error merging PDFs: $e');
    return null;
  }
}