scanWithConfiguration method

Future<Map> scanWithConfiguration (Map configuration)

Starts a scanning flow with 3 screens (Camera, Document Detection, Post Processing)

It takes a configuration parameter which can take the following options:

  • source: camera or image (defaults to camera)
  • sourceImageUrl: an absolute image url, required if source is image. Example: file:///var/…/image.png
  • multiPage: boolean (defaults to true). If true, after a page is scanned, a prompt to scan another page will be displayed. If false, a single page will be scanned.
  • defaultFilter: none, blackAndWhite, color, photo (by default, the filter is chosen automatically)
  • pdfPageSize: fit, a4, letter, defaults to fit.
  • pdfMaxScanDimension: max dimension in pixels when images are scaled before PDF generation, for example 2000 to fit both height and width within 2000px. Defaults to 0, which means no scaling is performed.
  • jpegQuality: JPEG quality used to compress captured images. Between 0 and 100, 100 being the best quality. Default is 60.
  • postProcessingActions: an array with the desired actions to display during the post processing screen (defaults to all actions). Possible actions are rotate, editFilter.
  • flashButtonHidden: boolean (default to false)
  • defaultFlashMode: auto, on, off (default to off)
  • foregroundColor: string representing a color, must start with a #. The color of the icons, text (defaults to '#ffffff').
  • backgroundColor: string representing a color, must start with a #. The color of the toolbar, screen background (defaults to black)
  • highlightColor: string representing a color, must start with a #. The color of the image overlays (default to blue)
  • menuColor: string representing a color, must start with a #. The color of the menus (defaults to system defaults.)

It returns a Future<Map> containing:

  • pdfUrl : a PDF file of the scanned pages (example: "file://.pdf")
  • scans: an array of scan objects. Each scan object has:
    • originalUrl: The original file as scanned from the camera. "file://.jpeg"
    • enhancedUrl: The cropped and enhanced file, as processed by the SDK. "file://.jpeg"

Implementation

static Future<Map> scanWithConfiguration(Map configuration) async {
  final Map result =
      await _channel.invokeMethod('scanWithConfiguration', configuration);
  return result;
}