Skip to content

API Reference

Arnelle Balane edited this page Jan 7, 2021 · 2 revisions

SmartScannerPlugin


Plugin API

executeScanner(opts)

Executes a call to the core SmartScanner library with the given options.

Accepts a single parameter opts, an object with the following properties:

Property Type Description
action string Should be always be START_SCANNER.
options object Options object for the SmartScanner.
options.mode string The scanner capturing mode to use. Possible values: mrz, barcode
options.mrzFormat string The MRZ format to scan, set only when mode='mrz'. Possible values: MRP, MRTD_TD1
options.barcodeOptions object Options object for the barcode scanner, set only when mode='barcode'. See smartscanner-core's BarcodeOptions for details.
options.config object Options object for the scanner's user interface. See Scanner Options for details.

Returns an object representing the scanned information. See Scanner Results for details about the result object.

Scanner Options

Options to configure the scanner's user interface.

Property Type Description
background string Hex value for the UI's background color.
font string The font to use in the UI. Possible values: NOTO_SANS_ARABIC (default), SOURCE_SANS_PRO
imageResultType string Possible values: path (default), base_64
isManualCapture boolean Enables manual capture of MRZ or barcode via a capture button when one is not detected. Default: false
label strinng The text to display below the scanner. Defaults to an empty string.

Scanner Results

Example MRZ scan result. See smartscanner-mrz-parser for details about the properties.

{
  "code": "TypeI",
  "code1": 73,
  "code2": 68,
  "dateOfBirth": "30/9/79",
  "documentNumber": "AB1234567",
  "expirationDate": "8/9/29",
  "format": "MRTD_TD1",
  "givenNames": " SALI",
  "image": "/data/user/0/org.idpass.smartscanner/cache/Scanner-20201123103638.jpg",
  "issuingCountry": "IRQ",
  "mrz": "IDIRQAB12345671180000000002\u003c\u003c\u003c\n7909308M2909082IRQ\u003c\u003c\u003c\u003c\u003c\u003c\u003c\u003c\u003c\u003c\u003c7\n\u003c\u003cSALI\u003c\u003c\u003c\u003c\u003c\u003c\u003c\u003c\u003c\u003c\u003c\u003c\u003c\u003c\u003c\u003c\u003c\u003c\u003c\u003c\u003c\u003c\u003c\u003c\n",
  "nationality": "IRQ",
  "sex": "Male",
  "surname": ""
}

Example barcode scan result.

{
  "corners": "65,-46 314,-14 306,171 65,141 ",
  "imagePath": "/data/user/0/org.idpass.smartscanner/cache/Scanner-20201123103911.jpg",
  "value": "036000291452"
}
Clone this wiki locally