🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

cordova-plugin-documentreader

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cordova-plugin-documentreader

Cordova plugin for identification documents reading and validation

0.6.3
latest
Source
npm
Version published
Weekly downloads
89
7.23%
Maintainers
1
Weekly downloads
 
Created
Source

cordova-plugin-documentreader

Cordova plugin for reading and validation of identification documents. Using Regula Document Reader with core DocumentReaderMRZBarcode.framework inside for iOS version.

Install

Install plugn:

cordova plugin add cordova-plugin-documentreader --variable CAMERA_USAGE_DESCRIPTION="To take photo" --save

Usage

You can get trial license for demo application at licensing.regulaforensics.com (regula.license file).

InitializeReader:

DocumentReader.initReader(
    license,
    function (result) {
        // result will contain array of json results.
    },
    function (error) {
        alert(error);
    }
);

ScanDocument:

DocumentReader.scanDocument(
    function (result) {
        // result will contain array of json results.
    },
    function (error) {
        alert(error);
    }
);

How to build demo application

  • Open terminal inside empty folder and run cordova create testdocumentreader <YOUR_APPLICATION_ID> DocumentReaderTest
  • Run cd testdocumentreader
  • Add plugin: cordova plugin add cordova-plugin-documentreader --variable CAMERA_USAGE_DESCRIPTION="To take photo" --save
  • Add cordova-plugin-file for get license file: cordova plugin add cordova-plugin-file --save
  • Get trial license for demo application at licensing.regulaforensics.com (regula.license file). When you will create license use <YOUR_APPLICATION_ID> like bundle ID (see the first paragraph).
  • Put license to www/regula.license.
  • Put this code inside onDeviceReady method file index.js (path: www/js/index.js) for calling DocumentReader plugin:
onDeviceReady: function() {
    this.receivedEvent('deviceready');

    window.resolveLocalFileSystemURL(
        cordova.file.applicationDirectory + "www/regula.license",
        function (fileEntry) {
            fileEntry.file(function(file) {
                var reader = new FileReader();
                reader.onloadend = function(e) {
                    DocumentReader.initReader(
                        this.result,
                        function (message) {
                            DocumentReader.scanDocument(
                                function (message) {
                                    alert(message);
                                },
                                function (error) {
                                    alert(error);
                                }
                            );
                        },
                        function (error) {
                            alert(error);
                        }
                    );
                }
                reader.readAsArrayBuffer(file);
            });
        }, function(e) {
            console.log("FileSystem Error");
            console.dir(e);
        });
},
  • Run cordova platform add ios
  • Run iOS project.

Keywords

cordova

FAQs

Package last updated on 10 May 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts