ID
Overview
The Anyline ID plugin (Universal ID) provides comprehensive functionality to scan MRZ documents, driving licenses, and identity cards in a single unified plugin. The plugin automatically detects document types and extracts relevant information based on the document layout.
Supported Document Types
-
MRZ Documents: Any ICAO standard Machine Readable Travel Document (passports, ID cards with MRZ, travel documents)
-
Driving Licenses: European driving licenses from Austria, Croatia, Germany, Italy, Portugal, and Spain
-
Identity Cards: European identity cards from Italy, Portugal, and Spain
Supported Scripts
Configuration supports latin, arabic, and cyrillic alphabets; the current implementation only supports Latin characters (incl. extended Latin such as À, Á, Â, Ä, Æ, Ç, È, É, etc.).
Quick Start Examples
MRZ (Identity Documents)
Scan passports and ID cards with Machine Readable Zones:
// initialize the Web SDK with the MRZ preset
const Anyline = init({
preset: 'universalid_mrz',
license: anylicense,
element: document.getElementById('root'),
// ... additional fields
});
Anyline.startScanning();
Anyline.onResult = function(result) {
console.log('MRZ Result: ', result.mrzResult);
// Access MRZ-specific fields:
// result.mrzResult.surname
// result.mrzResult.givenNames
// result.mrzResult.documentNumber
// result.mrzResult.dateOfBirth
// result.mrzResult.dateOfExpiry
// result.mrzResult.documentType
// result.mrzResult.issuingCountryCode
// result.mrzResult.nationalityCountryCode
};
Driving License - Austria & Germany
Scan Austrian and German driving licenses:
// initialize the Web SDK with the Austria/Germany driving license preset
const Anyline = init({
preset: 'universalid_dl_at_de',
license: anylicense,
element: document.getElementById('root'),
...
});
Anyline.startScanning();
Anyline.onResult = function(result) {
console.log('Universal ID Result: ', result.universalIdResult);
// Access driving license fields:
const data = result.universalIdResult.result;
// data.firstName.textValues.latin.text
// data.lastName.textValues.latin.text
// data.documentNumber.textValues.latin.text
// data.dateOfBirth.textValues.latin.text
// data.documentRegionDefinition.textValues.latin.text
};
Driving License & ID Card - Southern Europe
Scan Spanish, Italian, Portuguese, and Croatian documents:
// initialize the Web SDK for Southern European documents
const Anyline = init({
preset: 'universalid_es_it_pt',
license: anylicense,
element: document.getElementById('root'),
// ... additional fields
});
Anyline.startScanning();
Anyline.onResult = function(result) {
console.log('Universal ID Result: ', result.universalIdResult);
};
Advanced Configuration
Custom MRZ Configuration with Strict Mode
Configure MRZ scanning with strict validation and mandatory fields:
const Anyline = init({
preset: 'universalid_mrz',
config: {
mrzConfig: {
strictMode: true, // Only return results with valid check digits
minConfidence: 75, // Minimum confidence threshold
cropAndTransformID: true, // Crop and transform the document image
mrzFieldScanOptions: {
surname: 'mandatory',
givenNames: 'mandatory',
documentNumber: 'mandatory',
dateOfBirth: 'mandatory',
dateOfExpiry: 'mandatory',
personalNumber: 'optional'
}
},
cancelOnResult: true
},
license: anylicense,
element: root,
// ... additional fields
});
Filter Specific Document Layouts
Restrict scanning to specific document layouts:
const Anyline = init({
preset: 'universalid_es_it_pt',
config: {
universalIdConfig: {
allowedLayouts: {
drivingLicense: ['ES_DVL_O_06001_F'],
idFront: ['ES_IDC_O_05001_F']
}
}
},
license: anylicense,
element: root,
// ... additional fields
});
Mandatory Field Validation
Configure specific fields as mandatory with minimum confidence thresholds:
const Anyline = init({
preset: 'universalid_dl_at_de',
config: {
universalIdConfig: {
allowedLayouts: {
drivingLicense: ['AT_DVL_O_04001_F', 'DE_DVL_O_02007_F']
},
drivingLicense: {
lastName: { scanOption: 'mandatory', minConfidence: 80 },
firstName: { scanOption: 'mandatory', minConfidence: 80 },
dateOfBirth: { scanOption: 'mandatory', minConfidence: 80 },
documentNumber: { scanOption: 'mandatory', minConfidence: 80 }
}
},
cancelOnResult: true
},
license: anylicense,
element: root,
// ... additional fields
});
Enable All Document Types
Scan MRZ, driving licenses, and ID cards simultaneously:
const Anyline = init({
config: {
universalIdConfig: {
allowedLayouts: {
mrz: [], // Enable MRZ scanning
drivingLicense: [], // Enable all driving licenses
idFront: [] // Enable all ID cards
}
}
},
license: anylicense,
element: root,
// ... additional fields
});
Configuration Reference
For detailed information about all configuration parameters including universalIdConfig, mrzConfig, field configuration options, and their default values, see the Configuration Parameters Reference.
Result Structure
Universal ID Result (Driving License & ID Card)
{
universalIdResult: {
result: {
firstName: { textValues: { latin: { text: "SOPHIA" } } },
lastName: { textValues: { latin: { text: "KRAUS" } } },
documentNumber: { textValues: { latin: { text: "09264488" } } },
dateOfBirth: { textValues: { latin: { text: "02.01.1990" } } },
documentRegionDefinition: { textValues: { latin: { text: "AT" } } },
documentCategoryDefinition: { textValues: { latin: { text: "DVL" } } },
// ... additional fields depending on document type
}
}
}
Best Practices
Specify Exact Document Layouts
For optimal performance and accuracy, it’s recommended to define the exact document layouts you want to scan rather than using broad categories:
| Approach | Recommendation |
|---|---|
❌ Less optimal |
|
✅ Recommended |
|
Additional Resources
For complete details on supported fields, document layouts, and configuration options, see the ID Plugin Documentation.