structocr
v1.1.1
Published
The official Node.js SDK for StructOCR API - Extract data from Passports, ID Cards, and Driver Licenses.
Maintainers
Readme
StructOCR Node.js SDK
The official Node.js client for StructOCR.
StructOCR allows developers to extract structured data from identity documents with 99% accuracy. Integrate Passport OCR, National ID OCR, Driver License OCR and Invoice OCR into your Node.js or Electron applications.
Installation
Install via npm:
npm install structocr
Quick Start
1. Initialize the Client
const StructOCR = require('structocr');
// Initialize with your API Key
const client = new StructOCR('sk_live_xxxxxxxx');
2. Scan a Passport (Passport OCR)
Using async/await:
(async () => {
try {
const result = await client.scanPassport('./passport_sample.jpg');
console.log('Document Number:', result.data.document_number);
console.log('Full Name:', result.data.name);
} catch (error) {
console.error('OCR Failed:', error.message);
}
})();
3. Scan ID & Driver License & Invoice
// Scan National ID
const idData = await client.scanNationalId('./id_card.png');
// Scan Driver License
const licenseData = await client.scanDriverLicense('./license.jpg');
// Scan Driver License
const invoiceData = await client.scanInvoice('./invoice.jpg');
Features
- Passport Parsing: Extract MRZ, Name, DOB, Expiry Date.
- ID Card OCR: Automatic field mapping for National IDs.
- Driver License: Extract vehicle class and license numbers.
- Invoice: Extract invoice number, currency, merchant, customer.
- Base64 Handling: Automatically handles image encoding.
Documentation
For full API documentation, please visit StructOCR Docs.
License
MIT License.
