Barcode

Barcode Example

// import the Web SDK
const { init, errorCodes } = window.anylinejs;

// if copied into node_modules
// import { init, errorCodes } from 'anyline-js';


// create a view configuration
const viewConfig = {
    ...
};

const anylicense = 'xxxxxxx-your-license-xxxxxxx';

// access the container you want to mount the Web SDK into
const root = document.getElementById('root');

// initialize the Web SDK with optional presets
// presets will override some dimension configuration of your viewConfig and modules in the Web SDK config
const Anyline = init({
    preset: 'barcode',
    viewConfig,
    license: anylicense,
    element: root,
});

Anyline.startScanning();

Anyline.onResult = function(result) {
    console.log('Anyline has result: ', result);
};

Barcode Example with custom configuration

// import the Web SDK
const { init, errorCodes } = window.anylinejs;

// if copied into node_modules
// import { init, errorCodes } from 'anyline-js';

// create a view configuration
const viewConfig = {
    ...
};

const anylicense = 'xxxxxxx-your-license-xxxxxxx';

// access the container you want to mount the Web SDK into
const root = document.getElementById('root');

// initialize the Web SDK with a custom configuration
const Anyline = init({
    config: {
        module: 'barcode',
        barcodeConfig: {
            barcodeFormatOptions: [ 'QR_CODE' ],
        },
    },
    viewConfig: {
        feedbackStyle: 'rect',
        cutouts: [{
            cutoutConfig: {
            ratioFromSize: {
                width: 100,
                height: 40,
            },
            width: 900,
            maxWidthPercent: '80%',
            },
            scanFeedback: {
            style: 'rect',
            },
        },
        ],
    },
    license: anylicense,
    element: root,
});

Anyline.startScanning();

Anyline.onResult = function(result) {
    console.log('Anyline has result: ', result);
};