SmartScanner Capacitor
Capacitor plugin for the SmartScanner Core library to scan MRZ, NFC and barcodes.
Installation
This plugin can be installed from NPM:
npm install @idpass/smartscanner-capacitor
yarn add @idpass/smartscanner-capacitor
Usage
The plugin can be used by accessing SmartScannerPlugin from @idpass/smartscanner-capacitor directly.
import { SmartScannerPlugin } from '@idpass/smartscanner-capacitor';
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,
showGuide: true,
xGuide: 0.8,
yGuide: 0.5,
widthGuide: 150,
heightGuide: 40
},
},
});
NFC scanning example:
const result = await SmartScannerPlugin.executeScanner({
action: 'START_SCANNER',
options: {
mode: 'nfc-scan',
config: {
background: '#89837c',
branding: false,
isManualCapture: false,
},
},
});
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