createImageFromPDF static method

Future<List<String>?> createImageFromPDF({
  1. required String inputPath,
  2. required String outputDirectory,
  3. required ImageFromPdfConfig config,
})

Creates images from a PDF file in a separate isolate.

This method spawns an isolate (or uses compute on the web) to process the PDF asynchronously.

  • inputPath: The path to the input PDF file.
  • outputDirectory: The directory where the extracted images will be saved.
  • config: Configuration options for the image extraction process.

Returns a list of file paths of the extracted images, or null if an error occurs.

Implementation

static Future<List<String>?> createImageFromPDF({
  required String inputPath,
  required String outputDirectory,
  required ImageFromPdfConfig config,
}) async {
  if (PdfCombiner.isMock) {
    return await PdfCombinerPlatform.instance.createImageFromPDF(
      inputPath: inputPath,
      outputPath: outputDirectory,
      config: config,
    );
  }
  return await compute(_createImageFromPdf, {
    'inputPath': inputPath,
    'outputDirectory': outputDirectory,
    'config': config,
    'token': kIsWeb ? null : RootIsolateToken.instance!,
  });
}