0.5.0-beta.2 • Published 6 months ago

@idpass/smartscanner-cordova v0.5.0-beta.2

Weekly downloads
3
License
Apache-2.0
Repository
github
Last release
6 months ago

SmartScanner Cordova

Cordova plugin for the SmartScanner Core library to scan MRZ, NFC and barcodes.

Installation

This plugin can be installed from NPM:

# Using npm
npm install @idpass/smartscanner-cordova

# Using yarn
yarn add @idpass/smartscanner-cordova

# Then let cordova know about the plugin
cordova plugin add @idpass/smartscanner-cordova

Usage

The plugin is available in the cordova.plugins object, which is the registry of all available plugins.

const { SmartScannerPlugin } = cordova.plugins;

MRZ scanning example:

const result = await SmartScannerPlugin.executeScanner({
  action: 'START_SCANNER',
  options: {
    mode: 'mrz',
    mrzFormat: 'MRTD_TD1',
    config: {
      background: '#89837c',
      branding: false,
      isManualCapture: true,
    },
  },
});

OCR scanning example:

const result = await SmartScannerPlugin.executeScanner({
  action: 'START_SCANNER',
  options: {
    mode: 'ocr',
    ocrOptions: {
      type: 'documentNumber',
      regex: '\\d{4} \\d{4} \\d{5}'
    },
    config: {
      background: '#89837c',
      branding: false,
      isManualCapture: false, //if true user will be required to tap the capture button
      showGuide: true, //values below will only be used when this is set to true
      xGuide: 0.8, //accepts values from 0.0 - 1.0. Offsets the guide horizontally based on percentage.
      yGuide: 0.5, //accepts values from 0.0 - 1.0. Offsets the guide vertically based on percentage.
      widthGuide: 150, //sets the guide width. Default is 150
      heightGuide: 40 //sets the guide height. Default is 40
    },
  },
});

NFC scanning example:

```js
const result = await SmartScannerPlugin.executeScanner({
  action: 'START_SCANNER',
  options: {
    mode: 'nfc-scan',
    config: {
      background: '#89837c',
      branding: false,
      isManualCapture: true,
    },
  },
});

Barcode scanning example:

const result = await SmartScannerPlugin.executeScanner({
  action: 'START_SCANNER',
  options: {
    mode: 'barcode',
    barcodeOptions: {
      barcodeFormats: [
        'AZTEC',
        'CODABAR',
        'CODE_39',
        'CODE_93',
        'CODE_128',
        'DATA_MATRIX',
        'EAN_8',
        'EAN_13',
        'QR_CODE',
        'UPC_A',
        'UPC_E',
        'PDF_417',
      ],
    },
    config: {
      background: '#ffc234',
      label: 'Sample Label',
    },
  },
});

Refer to the API Reference for more information about the available API options and the returned result.

Related projects

License

Apache-2.0 License

0.5.0-beta.1

7 months ago

0.5.0-beta.2

6 months ago

0.4.5-beta

1 year ago

0.4.3

2 years ago

0.4.2-beta.4

2 years ago

0.4.4-beta

2 years ago

0.4.4

2 years ago

0.4.2-beta.3

2 years ago

0.4.2-beta.1

2 years ago

0.4.2-beta.2

2 years ago

0.4.2

2 years ago

0.4.1

2 years ago

0.4.0

2 years ago

0.3.24

2 years ago

0.3.23

2 years ago

0.3.22

2 years ago

0.3.21

2 years ago

0.3.20

2 years ago

0.3.19

2 years ago

0.3.18

2 years ago

0.3.17

3 years ago

0.3.16

3 years ago

0.3.15

3 years ago

0.3.14

3 years ago

0.3.13

3 years ago

0.3.12

3 years ago

0.3.11

3 years ago

0.3.10

3 years ago

0.3.9

3 years ago

0.3.6

3 years ago

0.3.8

3 years ago

0.3.7

3 years ago

0.3.5

3 years ago

0.3.4

3 years ago

0.3.3

3 years ago

0.3.2

3 years ago

0.3.1

3 years ago

0.3.0

3 years ago

0.3.0-beta.1

3 years ago