mergeMultiplePDFs method
Future<String>
mergeMultiplePDFs({
- required List<
MergeInput> inputs, - 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:
inputs: 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 returnsnull.
Implementation
@override
Future<String> mergeMultiplePDFs({
required List<MergeInput> inputs,
required String outputPath,
}) async {
final inputPaths = await Future.wait(inputs.map(
(MergeInput input) async => await DocumentUtils.prepareInput(input)));
final JSArray<JSString> jsInputPaths = inputPaths.toJSArray();
final JSString result =
(await combinePDFs(jsInputPaths).toDart) as JSString;
return result.toDart;
}