|
| 1 | +# Regula Document Reader js client for the browser and node.js example |
| 2 | + |
| 3 | + |
| 4 | +:bulb: Before you start: if you just want to play with an online demo, visit our [playground](https://api.regulaforensics.com). |
| 5 | + |
| 6 | +Requirements: |
| 7 | +- installed nodejs 12 or higher |
| 8 | +- installed npm 6 or higher |
| 9 | + |
| 10 | +Verify **Node.js** and **npm** version: |
| 11 | +```bash |
| 12 | +node --version |
| 13 | +> v12.18.3 |
| 14 | +npm --version |
| 15 | +> 6.14.6 |
| 16 | +``` |
| 17 | + |
| 18 | +Cloning example: |
| 19 | +```bash |
| 20 | +git clone https://github.com/regulaforensics/DocumentReader-web-js-client.git |
| 21 | +cd DocumentReader-web-js-client |
| 22 | +``` |
| 23 | + |
| 24 | +Setup project and download dependencies: |
| 25 | +```bash |
| 26 | +npm install |
| 27 | +npm run build |
| 28 | +cd example |
| 29 | +npm install |
| 30 | +``` |
| 31 | + |
| 32 | +### Running with local Regula Document Reader web API installation |
| 33 | + |
| 34 | +Follow [the instructions](https://docs.regulaforensics.com/web/quick-start-guide) to run Regula Document Reader web API. |
| 35 | +Assuming you have successfully launched instance, use next line command to run example: |
| 36 | +```bash |
| 37 | +# from example folder |
| 38 | +node . |
| 39 | + |
| 40 | +# If Regula Document Reader web API is running not on localhost, specify host via env variable: |
| 41 | +API_BASE_PATH="http://192.168.0.101:8080" node . |
| 42 | +``` |
| 43 | + |
| 44 | +### Running using Regula Document Reader web API test SaaS |
| 45 | + |
| 46 | +Get your [free trial here](https://mobile.regulaforensics.com/). You should obtain `regula.license` file. |
| 47 | +Copy it to **example** folder. You are ready for running! |
| 48 | + |
| 49 | +Execute example: |
| 50 | +```bash |
| 51 | +# from example folder |
| 52 | +API_BASE_PATH="https://test-api.regulaforensics.com" node . |
| 53 | +``` |
| 54 | + |
| 55 | +### Output |
| 56 | +This sample generates next text output: |
| 57 | +```text |
| 58 | + --------------------------------------------------------------------------- |
| 59 | + Document Overall Status: not valid |
| 60 | + Document Number Visual: U0996738 |
| 61 | + Document Number MRZ: U0996738 |
| 62 | + Validity Of Document Number Visual: 1 |
| 63 | + Validity Of Document Number MRZ: 1 |
| 64 | + MRZ-Visual values comparison: 1 |
| 65 | + --------------------------------------------------------------------------- |
| 66 | +``` |
| 67 | +Also, it creates [portrait](portrait.jpg) and [document image](document-image.jpg) pictures inside current folder. |
| 68 | +Edit [example](./index.js) on your own , and re-run to see your results. |
0 commit comments