generateDocument static method

Future<void> generateDocument(
  1. Map document,
  2. Map configuration
)

Generate a document from a list of scans

It takes a document map with the following values:

  • pages: an array of page objects. Each page object has:
    • imageUrl: the URL of the PNG or JPEG image file for this page, e.g. file:///path/to/file.{jpeg|png}
    • hocrTextLayout: the text layout in hOCR format

It also takes a configuration parameter with the following options:

  • outputFileUrl: the URL where the document should be generated, e.g. file:///path/to/file.pdf
  • pdfFontFileUrl: Custom font file used during the PDF generation to embed an invisible text layer. If null, a default font is used, which only supports Latin languages.

Errors are returned as a PlatformException with a structured payload in details. The payload's code is one of cancellation_error, configuration_error, licensing_error, capture_error, storage_space_error, or internal_error.

Implementation

static Future<void> generateDocument(Map document, Map configuration) async {
  await _channel.invokeMethod('generateDocument', <String, dynamic>{
      'document': document,
      'configuration': configuration,
    });
}