mergeMultiplePDFs static method
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.
inputPaths
: 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<String> inputPaths,
required String outputPath,
}) async {
if (PdfCombiner.isMock) {
return await PdfCombinerPlatform.instance.mergeMultiplePDFs(
inputPaths: inputPaths,
outputPath: outputPath,
);
}
return await compute(_combinePDFs, {
'inputPaths': inputPaths,
'outputPath': outputPath,
'token': kIsWeb ? null : RootIsolateToken.instance!,
});
}