Barcode

The Web SDK Barcode Plugin is a JavaScript library that allows you to scan barcodes in the browser. Anyline has leveraged our extensive computer vision and machine-learning expertise to develop a best-in-class 1D and 2D barcode symbology SDK. With the ability to tolerate real-world variations like reflections, warping due to cylindrical or curved surfaces, low contrast codes, damaged or obscured codes, and inverted polarity codes, customers can realize faster throughput and more accurate data quality in their front-line barcode scanning applications.

Anyline License

The use of the barcode engine is determined by the license that the SDK is initialised with. If the used license includes the new engine for iOS or Android, the Web SDK will automatically switch to the new engine when upgrading. The new engine has to download additional files from the internet and can not be fully self-hosted. To enable the extended and improved barcode formats please contact Anyline support if you are using a license that was issued before the release of Web SDK 42.1 (2022/12/01).

Configuring the Web SDK Barcode Plugin

Example Config

config: {
  barcodeConfig: {
    barcodeFormats: [ 'QR_CODE', 'DATA_MATRIX' ],
    parseAAMVA: false,
    multiBarcode: true
  }

Config Parameters

  • parseAAMVA
    • type: boolean

    • default: false

    • description: Parses the content of AAMVA ID inside PDF417 codes. Returns the parsed data as pdf17_parsed in the result.

  • multiBarcode
    • type: boolean

    • default: false

    • description: If set to true, the plugin will scan multiple barcodes at the same time.

  • disableAdvancedBarcode
    • type: boolean

    • default: false

    • description: If set to true, the plugin will not use the new barcode engine.

  • barcodeFormats
    • An array of barcode formats to scan.

    • The default is all supported barcode formats.

    • Symbologies supported by the barcode module:

      • AZTEC_INVERSE, RSS_EXPANDED, MATRIX_2_5, QR_INVERSE, GS1_QR_CODE, MICRO_QR, UPC_A, UPC_E, EAN_8, EAN_13, COUPON, TRIOPTIC, ITF, DISCRETE_2_5, MSI, MICRO_PDF, GS1_128, BOOKLAND, ISBT_128, CODE_11, CODE_93, CODE_128, CODE_32, CODE_39, PDF_417, DATA_MATRIX, CODABAR, QR_CODE, UPC_EAN_EXTENSION, DATA_MATRIX_INVERSE, DATABAR, GS1_DATABAR_LIMITED, ALL

    • Symbologies supported by the legacy barcode module:

      • AZTEC, CODABAR, CODE_39, CODE_93, CODE_128, DATA_MATRIX, EAN_8, EAN_13, ITF, PDF_417, QR_CODE, RSS_14, RSS_EXPANDED, UPC_A, UPC_E, UPC_EAN_EXTENSION\',`ALL`

    • The Web SDK does not support all of the symbologies that are supported by the iOS & Android SDK yet.

onResult

This is a callback method of the barcode plugin that is called once a barcode has been scanned. This method is only called once for every Barcode that was found..

onResult(barcodes) {
  // barcodes is an array of barcodes found in the current frame
  barcodes.forEach(barcode => {
    console.log(barcode.text);
  });
}

onScannedBarcodes

This is a callback method of the barcode plugin that is called for every scanned frame that contains barcodes. This callback will be called very often with every barcode value the user is focusing on.

onScannedBarcodes(barcodes) {
  // barcodes is an array of barcodes found in the current frame
  barcodes.forEach(barcode => {
    console.log(barcode.text);
  });
}
Barcode Scan Result

The callback returns a dictionary that has 1 key named barcodes. This key stores an array holding the scanned barcodes.

The barcode result elements:

Field Description

value

The value of the barcode as text

format

The symbology of the scanned barcode (e.g. QR_CODE)

coordinates

A dictionary containing the 4 corner points of the scanned barcode: { x1: 100, y1: 100, x2: 200, y2: 200, x3: 200, y3: 400, x4: 500, y4: 500 }

pdf17_parsed

If parsePDF417 is set to true, this field contains the parsed data of the scanned PDF417 barcode.