@finwave/ocrid-v2 v1.0.6
@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.
Features
- 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.
Installation
Install the package via NPM:
npm install @finwave/ocrid-v2Usage
Importing the Library
Import the library in your project:
import { OcrId } from '@finwave/ocrid-v2';Creating an Instance
Create an instance of the library:
const ocr = new OcrId({
key: 'YOUR_API_KEY',
env: 'ENVIRONMENT',
});Subscribe to Events
// 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);
});Start the OCR Process
const videoElement = document.getElementById("videoContainer");
ocr.startStream(videoElement)
.then(() => {
console.log("OCR stream started");
})
.catch((err) => {
console.error("Failed to start OCR stream:", err);
});Close the OCR Process
ocr.close();
console.log("OCR stream closed");API
OcrId Constructor
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
Events
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.
Support
For assistance, or to request an API key, please contact us at:
📧 Email: soporte.onboarding@finwave.es