startScanProcess method

Future<OcrTextRecognizerResult?> startScanProcess(
  1. File file
)

Implementation

Future<OcrTextRecognizerResult?> startScanProcess(
  File file,
) async {
  String extension = path.extension(file.path).toLowerCase();

  assert(extension == '.pdf' ||
      extension == '.png' ||
      extension == '.jpg' ||
      extension == '.jpeg');
  if (extension == '.pdf') {
    final PdfDocument document = await PdfDocument.openFile(
      file.path,
    );
    return await _processStaticPDF(
      document,
      scanModules,
    );
  } else if (extension == '.png' ||
      extension == '.jpg' ||
      extension == '.jpeg') {
    return await _processStaticImage(
      file,
      scanModules,
    );
  }
  return null;
}