1.Install the plugin.
ionic cordova plugin add cordova-plugin-mrzscanner
-To interact with the module, you need to add a global variable declare var MrzScanner; (its needs to specifically be named "MrzScanner") :
declare var MrzScanner: any;
Activates the scanner, with a default SCANNER_TYPE_MRZ if not specified.
@return: ‘successfulMrzScan’: returns results of your scan as JSON Object
@return: ‘scanFailed’ : returns error String
MrzScanner.startScanner(success, error);
Stop and close the MRZ Scanner
MrzScanner.closeScanner();
Specify the maximum number of CPU threads that the scanner can use
during the scanning process.
@param Int: maxThreads, number of CPU threads. The default value is 2.
MrzScanner.setMaxThreads(maxThreads);
Set the zoom factor for the camera preview.
@param number. Default value is 1.0
MrzScanner.setZoomFactor(zoomFactor: number)
Specify which scanner type you want to use. There are two options: "MRZ Scanner" and "Document Image scanner". The "MRZ Scanner" option is used to scan for MRZ.
The "Document image scanner" is used for capturing the front and back image of the ID documents.
@param Int : scannerTyle [1: SCANNER_TYPE_MRZ, 2: SCANNER_TYPE_DOC_IMAGE_ID, 3 : SCANNER_TYPE_DOC_IMAGE_PASSPORT]. Default value is SCANNER_TYPE_MRZ
MrzScanner.setScannerType(scannerTyle);
Example: MrzScanner.setScannerType(1);
Resume scanning after the scanner has been paused/stopped. Usually after a successful scan.
MrzScanner.resumerScanner();
Set the date format in which the parsed dates are formatted.
@param dateFormat the pattern describing the date format.
Example: "dd.MM.yyyy"
MrzScanner.setDateFormat("dd.MM.yyyy");
@return : versionStringSuccess - returns the current SDK Version.
MrzScanner.getSdkVersion(success, error);
Specify whether the scanner should detect and return results for IDs.
@param activate [true, false]. The default value is true.
MrzScanner.setIDActive(activate);
Specify whether the scanner should detect and return results for passports.
@param activate [true, false]. The default value is true
MrzScanner.setPassportActive(activate);
Specify whether the scanner should detect and return results for *visas.
@param activate [true, false]. Default value is true.
MrzScanner.setVisaActive(activate);
Register with the license key provided to remove the asterisks (*) from the result.
@param key the provided license key.
@return : resultKey = 0 for success, -1 if registration failed.
MrzScanner.registerWIthLicenseKey(arg0, success, error);
To get your evaluation key today, register an account on https://mrzscanner.com/register
Trigger an image picker.
@return: ‘successfulMrzScan’: returns results of your scan as JSON Object
MrzScanner.scanFromGalley(success);
Initiates the scanner view with continuous scanning enabled.
After a successful scan, the scanner will not be dismissed or paused.
To close the scanner call closeScanner().
See setIgnoreDuplicatesEnabled for further continuous scanning behavior changes.
@param boolean: activate.
MrzScanner.setContinuousScanningEnabled(activate);
Ignores duplicate is used to specify whether the scanner should ignore *the successful scan if the document number is identical to the previous *successful scan.
@param boolean: activate.
MrzScanner.setIgnoreDuplicatesEnabled(activate);
Enables vibrate on a successful scan option.
@param boolean: activate.
MrzScanner.setVibrateOnSuccessfulScan(activate);
Set the scanning rectangle to limit the scanning area. The parameters' values are representing percentages of the scanning preview.
@param x the top-left point of the scanning rectangle. [0,...,100]Default value: 5.
@param y the top-left point of the scanning rectangle. [0,...,100]Default value: 20.
@param width the width of the scanning rectangle. [0,...,100]Default value: 90.
@param height the height of the scanning rectangle. [0,...,100]Default value: 60.
MrzScanner.startPartialViewScanner(x,y,width,height);
*Sample apps and more detailed instructions are included with the download file.
Download link: https://mrzscanner.com/download.