JSPM

@regulaforensics/document-reader-webclient

5.3.0-beta.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 7949
  • Score
    100M100P100Q153480F
  • License MIT

Regula Document Reader js client for the browser and node.js based on axios

Package Exports

  • @regulaforensics/document-reader-webclient
  • @regulaforensics/document-reader-webclient/esm

Readme

Regula Document Reader js client for the browser and node.js based on axios

npm version npm type definitions documentation OpenAPI live

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:

// text fields
const docNumber = result.getTextField(DOCUMENT_NUMBER)
const fullName = result.getTextField(SURNAME_AND_GIVEN_NAMES)
const dateOfBirth = result.getTextField(DATE_OF_BIRTH)
    
// graphics fields
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)