Regula Document Reader js client for the browser and node.js based on axios
Documents recognition as easy as reading two bytes.
If you have any problems with or questions about this client, please contact us
through a GitHub issue.
You are invited to contribute new features, fixes, or updates, large or small;
We are always thrilled to receive pull requests, and do our best to process them as fast as we can.
See dev guide
Install package
npm install @regulaforensics/document-reader-webclient
Example
Performing request:
import {DocumentReaderApi, FieldType, GraphicFieldType} from '@regulaforensics/document-reader-webclient/esm'
const {DOCUMENT_NUMBER, SURNAME_AND_GIVEN_NAMES, DATE_OF_BIRTH} = FieldType;
const {PORTRAIT, SIGNATURE} = GraphicFieldType;
const imageAsBase64String = getDocImageAsBase64String()
const api = new DocumentReaderApi({basePath: "http://localhost:8080"});
const result = await api.process(imageAsBase64String)
Parsing results:
const docNumber = result.getTextField(DOCUMENT_NUMBER)
const fullName = result.getTextField(SURNAME_AND_GIVEN_NAMES)
const dateOfBirth = result.getTextField(DATE_OF_BIRTH)
const portraitAsBase64 = result.getGraphicsField(PORTRAIT)
const signatureAsBase64 = result.getGraphicsField(SIGNATURE)
Compatibility
Language level
- ES5, ES6.Promises - depends on a native ES6 Promise implementation to be supported. If your environment doesn't support ES6 Promises, you can polyfill.
Module system
- CommonJS
- ES6 module system
Definitions
- TypeScript's definitions should be automatically resolved via
package.json
. (Reference)