Plugin Configuration and Presets
The Anyline Web SDK uses two configuration components:
-
PluginConfig (
config): Defines what to scan (e.g., barcode formats, ID types, meter settings) -
ViewConfig (
viewConfig): Defines how scanning appears (e.g., cutout dimensions, visual feedback, UI)
Presets provide pre-configured defaults for common use cases. You can use presets as-is, customize them, or configure entirely from scratch.
Available Presets
| Category | Preset | Description |
|---|---|---|
Barcode |
|
QR code scanning only |
|
All supported 1D and 2D barcode formats |
|
|
PDF417 barcode scanning |
|
|
PDF417 with AAMVA parsing (US driver’s licenses) |
|
|
Legacy barcode engine (compatibility mode) |
|
ID Scanning |
|
Machine Readable Zone (passports, ID cards) |
|
Austrian and German driving licenses |
|
|
AT/DE driving licenses with strict validation |
|
|
Spanish, Italian, Portuguese, and Croatian driving licenses, and Spanish, Italian, and Portuguese ID cards |
|
|
United Kingdom driving licenses |
|
|
Japanese Landing Permission |
|
License Plates |
|
General license plate recognition |
|
European license plates |
|
|
United States license plates |
|
|
Canadian license plates |
|
Tire & Automotive |
|
Vehicle Identification Number (fast mode) |
|
VIN with real-time user guidance feedback |
|
|
Tire Identification Number |
|
|
Tire DOT number |
|
|
Tire size information |
|
|
Complete tire identification |
|
Containers |
|
Horizontal shipping container codes |
|
Vertical shipping container codes |
|
Meters |
|
Analog and digital meter reading |
|
Dial meter reading |
|
|
Multi-field digital meter reading with OBIS code |
|
|
Verbund utility meter |
|
OCR |
|
General optical character recognition |
Customizing Presets
When you provide both a preset and custom config or viewConfig, your values override the preset defaults:
-
The preset’s configuration serves as the base.
-
Your configuration is merged on top. Nested objects are merged, and your values win. For example,
offset: { y: 20 }changes onlyyof the preset’s offset. If neither you nor the preset setxory, it counts as 0. ForcropOffsetandcropPadding, a singlexoryworks only if the preset sets the other value. Otherwise, set both. -
A list replaces the preset’s list. For example, your
barcodeFormatsreplace the preset’s formats. -
In
viewConfig, your cutout is merged into the preset’s cutout. A preset supports only one cutout; more than one throwsInvalidViewConfigError. YouruiFeedbackreplaces the preset’s as a whole. -
Values set to
undefinedare ignored, so the preset value stays.
const anyline = init({
preset: 'all_barcode_formats',
// Override specific preset values
config: {
barcodeConfig: {
barcodeFormats: ['QR_CODE', 'DATA_MATRIX'], // Replaces the preset's formats
multiBarcode: false
}
},
// Customize visual appearance
viewConfig: {
cutouts: [{
cutoutConfig: {
strokeColor: '00FF00' // Overrides preset cutout color
}
}]
},
license: 'your-license-key',
element: document.getElementById('root')
});
Configuration Without Presets
You can configure the SDK entirely without presets by providing complete config and viewConfig objects.
const anyline = init({
// No preset specified
config: {
barcodeConfig: {
barcodeFormats: ['QR_CODE'],
multiBarcode: false
},
cancelOnResult: true
},
viewConfig: {
cutouts: [{
cutoutConfig: {
alignment: 'center',
width: 1000,
maxWidthPercent: '80%',
ratioFromSize: {
width: 16,
height: 9
},
strokeColor: 'FFFFFF',
strokeWidth: 3
},
scanFeedback: {
style: 'rect',
strokeColor: '00FF00'
}
}]
},
license: 'your-license-key',
element: document.getElementById('root')
});
|
When configuring manually, provide exactly one plugin-specific section (e.g., |
Configuration Reference
| Configuration | Description | Reference |
|---|---|---|
PluginConfig |
Plugin-specific settings: barcode formats, ID types, meter modes, validation options |
|
ViewConfig |
Visual settings: cutout dimensions, scan feedback, overlay styling |
|
UI Feedback |
Dynamic user guidance: lighting and distance indicators |
|
AnylineJSParams |
All initialization parameters including presets, callbacks, and SDK options |
See Also
-
Getting Started - Quick start guide
-
Examples - Framework integration examples
-
Error Handling - Configuration error handling