OCR ID library for document verification.
npm install @finwave/ocrid-v2@finwave/ocrid-v2 is a powerful library for identity document verification and onboarding. It provides tools for capturing, processing, and analyzing ID documents with a customizable and event-driven interface.
---
- OCR Scanning: Capture and process identity documents efficiently.
- Event-Driven: React to various stages of the scanning and processing workflow.
- TypeScript Support: Fully typed for enhanced developer experience and IDE support.
---
Install the package via NPM:
``bash`
npm install @finwave/ocrid-v2
---
Import the library in your project:
`typescript`
import { OcrId } from '@finwave/ocrid-v2';
Create an instance of the library:
`typescript`
const ocr = new OcrId({
key: 'YOUR_API_KEY',
env: 'ENVIRONMENT',
});
`typescript
// Subscribe to specific events
ocr.events(EventType.RESULT).subscribe((result) => {
console.log("Processing result:", result);
});
ocr.events(EventType.ERROR).subscribe((error) => {
console.error("An error occurred:", error);
});
`
`typescript
const videoElement = document.getElementById("videoContainer");
ocr.startStream(videoElement)
.then(() => {
console.log("OCR stream started");
})
.catch((err) => {
console.error("Failed to start OCR stream:", err);
});
`
`typescript`
ocr.close();
console.log("OCR stream closed");
---
`typescript`
new OcrId(options: OcrIdOptions);
#### Parameters
- options (OcrIdOptions): An object containing the following properties:key
- (string): Your API key.env
- (string): The environment to use.config
- : (object): Optional configuration for the OCR process.
Copiar código
---
Use the events method to subscribe to specific events emitted by the library:
CONNECTED: Emitted when the connection to the backend is established.RESULT: Emitted when the document is successfully processed.ERROR: Emitted in case of an error during processing.USER_FEEDBACK: Emitted for feedback on user interactions.CLOSED`: Emitted when the process is closed.
---
For assistance, or to request an API key, please contact us at:
📧 Email: soporte.onboarding@finwave.es