mergeMultiplePDFs static method
Future<String?>
mergeMultiplePDFs({
- required List<
MergeInput> inputs, - required String outputPath,
Merges multiple PDFs into a single file in a separate isolate.
This method spawns an isolate (or uses compute on the web) to process
the PDF merging asynchronously.
inputs: A list of file paths of the input PDFs.outputPath: The file path where the merged PDF will be saved.
Returns the path of the merged PDF, or null if an error occurs.
Implementation
static Future<String?> mergeMultiplePDFs({
required List<MergeInput> inputs,
required String outputPath,
}) async {
if (PdfCombiner.isMock) {
final error = await _validate(inputs, outputPath);
if (error != null) return error;
return await PdfCombinerPlatform.instance.mergeMultiplePDFs(
inputs: inputs,
outputPath: outputPath,
);
}
return await compute(_combinePDFs, {
'inputs': inputs,
'outputPath': outputPath,
'token': kIsWeb ? null : RootIsolateToken.instance!,
});
}