barcode by Trigger.io

Currently displaying version

barcode: Barcode / QR Code scanner

Note: barcode is a premium module so not available during your free trial. To use this module you must upgrade your Project to a paid plan by clicking 'Change plan' on your account page.

The forge.barcode namespace allows the user to scan a barcode or QR code using the device's camera and returns its content.

This module makes use of the ZXing image processing library. You can read about the support formats on the project homepage

API

forge.barcode.scan(success, error)

iOS, Android

Show a UI that allows the user to scan a barcode and return its value.

Parameters:
success
function(value) called with the barcode value after a successful scan
error
function(content) called with details of any error which may occur

Example:

    forge.barcode.scan(function (value) {
        alert("You scanned: "+value);
    });

forge.barcode.scanWithFormat(success, error)

iOS, Android

Show a UI that allows the user to scan a barcode and return its value and type.

Parameters:
success
function(barcode) callback to be invoked when no errors occur - barcode will contain format and value keys, where format is the barcode type as returned by ZXing
error
function(content) called with details of any error which may occur

Example:

forge.barcode.scanWithFormat(function (barcode) {
    alert("You scanned a: "+barcode.format+": "+barcode.value);
});