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

QR code scanning only

all_barcode_formats

All supported 1D and 2D barcode formats

barcode_pdf417

PDF417 barcode scanning

barcode_pdf417_parsed

PDF417 with AAMVA parsing (US driver’s licenses)

legacy_barcode

Legacy barcode engine (compatibility mode)

ID Scanning

universalid_mrz

Machine Readable Zone (passports, ID cards)

universalid_dl_at_de

Austrian and German driving licenses

universalid_dl_at_de_strict

AT/DE driving licenses with strict validation

universalid_es_it_pt

Spanish, Italian, Portuguese, and Croatian driving licenses, and Spanish, Italian, and Portuguese ID cards

universalid_dl_uk

United Kingdom driving licenses

japanese_landing_permission

Japanese Landing Permission

License Plates

lpt

General license plate recognition

lpt_eu

European license plates

lpt_us

United States license plates

lpt_canada

Canadian license plates

Tire & Automotive

vin

Vehicle Identification Number (fast mode)

vin_with_user_guidance

VIN with real-time user guidance feedback

tin

Tire Identification Number

tin_dot

Tire DOT number

tire_size

Tire size information

tire_id

Complete tire identification

Containers

container

Horizontal shipping container codes

containerVertical

Vertical shipping container codes

Meters

meter

Analog and digital meter reading

dialmeter

Dial meter reading

multi_field_meter

Multi-field digital meter reading with OBIS code

verbund

Verbund utility meter

OCR

ocr

General optical character recognition

Customizing Presets

When you provide both a preset and custom config or viewConfig, your values override the preset defaults:

  1. The preset’s configuration serves as the base.

  2. Your configuration is merged on top. Nested objects are merged, and your values win. For example, offset: { y: 20 } changes only y of the preset’s offset. If neither you nor the preset set x or y, it counts as 0. For cropOffset and cropPadding, a single x or y works only if the preset sets the other value. Otherwise, set both.

  3. A list replaces the preset’s list. For example, your barcodeFormats replace the preset’s formats.

  4. In viewConfig, your cutout is merged into the preset’s cutout. A preset supports only one cutout; more than one throws InvalidViewConfigError. Your uiFeedback replaces the preset’s as a whole.

  5. Values set to undefined are 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., barcodeConfig or vinConfig). Supplying none or multiple sections causes an initialization error.

Configuration Reference

Configuration Description Reference

PluginConfig

Plugin-specific settings: barcode formats, ID types, meter modes, validation options

Schema Reference

ViewConfig

Visual settings: cutout dimensions, scan feedback, overlay styling

ViewConfig Reference

UI Feedback

Dynamic user guidance: lighting and distance indicators

UI Feedback Guide

AnylineJSParams

All initialization parameters including presets, callbacks, and SDK options

API Reference

See Also