Fliplet.Barcode

Install

Add the fliplet-barcode dependency to your screen or app resources.

Fliplet.Barcode.scan()

(Returns Promise)

Scan a QR code or barcode.

Note: Barcode scanning is only supported in native apps.

Usage

Fliplet.Barcode.scan(options).then(function (result) {
  // result.text
  // result.format
  // result.cancelled
}).catch(function (error) {
  // scan failed
});
options = {
  preferFrontCamera: false, // iOS and Android
  showFlipCameraButton: true, // iOS and Android
  showTorchButton: true, // iOS and Android
  torchOn: false, // Android, launch with the torch switched on (if available)
  saveHistory: true, // Android, save scan history (default false)
  prompt: 'Place a barcode inside the scan area', // Android
};

Fliplet.Barcode.show()

(Returns Promise)

Encode text into QR code or barcode and show it on the screen.

Note: A QR code is generated by default unless an alternative format is provided (see below).

Usage

Fliplet.Barcode.show(text).then(function (data) {
  // data (String) Encoded Base64 string
}).catch(function (error) {
  // encoding failed
});
Fliplet.Barcode.show(text, options).then(function (data) {
  // data (String) Encoded Base64 string
}).catch(function (error) {
  // encoding failed
});

Note If a barcode is generated instead of a QR code, adjust height and lineWidth according to the text length. Fliplet recommends using QR codes unless a barcode is required because QR codes are always generated in a 1:1 aspect ratio.

Fliplet.Barcode.encode()

(Returns Promise)

Encode text into QR code or barcode and return it as a Base64 image.

Note: A QR code is generated by default unless an alternative format is provided (see below).

Usage

Fliplet.Barcode.encode(text).then(function (data) {
  // data (String) Encoded Base64 string
}).catch(function (error) {
  // encoding failed
});
Fliplet.Barcode.encode(text, options).then(function (data) {
  // data (String) Encoded Base64 string
}).catch(function (error) {
  // encoding failed
});

Note If a barcode is generated instead of a QR code, adjust height and lineWidth according to the text length. Fliplet recommends using QR codes unless a barcode is required because QR codes are always generated in a 1:1 aspect ratio.


Back to Fliplet.UI