Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yushulx/mrz4nodejs
Node.js MRZ detection SDK built with Dynamsoft Label Recognizer
https://github.com/yushulx/mrz4nodejs
idcard mrz nodejs passport visa
Last synced: 4 days ago
JSON representation
Node.js MRZ detection SDK built with Dynamsoft Label Recognizer
- Host: GitHub
- URL: https://github.com/yushulx/mrz4nodejs
- Owner: yushulx
- License: mit
- Created: 2022-08-30T07:49:42.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-10-10T05:29:40.000Z (2 months ago)
- Last Synced: 2024-11-30T14:16:11.172Z (22 days ago)
- Topics: idcard, mrz, nodejs, passport, visa
- Language: C++
- Homepage: https://www.npmjs.com/package/mrz4nodejs
- Size: 21.1 MB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Node.js MRZ Scanner SDK
The Node.js MRZ (Machine Readable Zone) Scanner SDK is Node binding to [Dynamsoft MRZ C++ SDK](https://www.dynamsoft.com/label-recognition/overview/). It helps developers to build Node.js applications for scanning passport, Visa, ID card and travel documents on Windows and Linux.
## License Key
Get a [30-day FREE trial license](https://www.dynamsoft.com/customer/license/trialLicense/?product=dcv&package=cross-platform) to activate the SDK.## Pre-requisites
- [Node.js](https://nodejs.org/en/download/)
- Platform-specific C/C++ compiler
- TypeScript```bash
npm install -g typescript
npm install --save @types/node
```
- node-gyp```
npm i node-gyp -g
```## Supported Platforms
- **Windows**
- **Linux**## Usage
Basic steps:
1. Set the license key.```js
MrzScanner.initLicense('DLS2eyJoYW5kc2hha2VDb2RlIjoiMjAwMDAxLTE2NDk4Mjk3OTI2MzUiLCJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSIsInNlc3Npb25QYXNzd29yZCI6IndTcGR6Vm05WDJrcEQ5YUoifQ==');
```
2. Create an MRZ scanner object.
```js
var obj = new MrzScanner();
```
3. Load the MRZ model via the `mrz4nodejs` module path.```js
var ret = obj.loadModel(path.dirname(require.resolve('mrz4nodejs')));
```4. Call `decodeFileAsync()` method to recognize MRZ from an image file.
```js
(async function () {
try {
var result = await obj.decodeFileAsync('');
console.log(result);
} catch (error) {
console.log(error);
}
})();
```
5. Parse the MRZ information:```js
if (result.length == 2) {
console.log(obj.parseTwoLines(result[0].text, result[1].text));
}
else if (result.length == 3) {
console.log(obj.parseThreeLines(result[0].text, result[1].text, result[2].text));
}
```## Sample Code
[https://github.com/yushulx/mrz4nodejs/tree/main/examples](https://github.com/yushulx/mrz4nodejs/tree/main/examples)
![Node.js MRZ scanner SDK](https://www.dynamsoft.com/codepool/img/2022/02/node-js-mrz-sdk.png)