@wubook/mrz
v2.0.17
Published
Parse MRZ (Machine Readable Zone) from identity documents || PATCH
Downloads
38
Maintainers
Readme
Parse MRZ info from some ocr'ed text
Install
npm i @wubook/mrz
Example
import { parse_mrz } from "@wubook/mrz"
const MRZ_ES = [
"IDESPBAE112233612345678Z<<<<<<",
"8309204M2510273ESP<<<<<<<<<<<3",
"JUANITO<JUANO<<JUANES<<<<<<<<<",
]
const locale = 'ES' // optional
const result = parse_mrz(ocr_text, locale)
console.log(result)
/**
{
_meta: {
mrz_size: 1,
ocr: {
raw: ["IDESPBAE112233612345678Z<<<<<<","8309204M2510273ESP<<<<<<<<<<<3","JUANITO<JUANO<<JUANES<<<<<<<<<"],
fixed: ["IDESPBAE112233612345678Z<<<<<<","8309204M2510273ESP<<<<<<<<<<<3","JUANITO<JUANO<<JUANES<<<<<<<<<"]
}
},
name: 'Juanes',
surname: 'Juanito Juano',
birthday: 432856800,
gender: 'm',
citizenship: 'ES',
doc_type: 'i',
doc_number: '12345678Z',
doc_country: 'ES',
doc_expiry: 1761519600,
doc_issue: null,
optional1: 'BAE112233',
optional2: '',
score: 100,
checks: {
name: true,
birthday: true,
gender: true,
citizenship: true,
doc_type: true,
doc_number: true,
doc_country: true,
doc_expiry: true,
doc_issue: null,
optional1: true,
optional2: true,
composite: true
}
}
**/
Prior version 1.0.0
Originally forked from https://github.com/cheminfo/mrz.
Updates added:
- patch for FR documents
- stripped out unnecessary exports (states, formats)
- smart clean and pre-parse MRZ lines for better results
- return document data using WB style
- build with rollup