PRE-REQUISITES

For the following code examples to work, you will need to add the fliplet-barcode library to your app. To add it follow these steps:

  1. When in Fliplet Studio’s Edit screen, open the Developer Options from the right hand menu
  2. With the Developer Options open, click the Libraries button in the top right corner
  3. In the search field, type in ‘fliplet-barcode’
  4. Click it to add it to the list
  5. Click Save

Fliplet.Barcode.show() can be used to present a barcode/QR code on the screen based on the text that has been provided (ie, the text that you want to be encoded in the barcode or QR code). By default the text is encoded into a QR code. See here for more options.

The example below transforms ‘https://fliplet.com’ into a barcode.

var options = {
  format: 'qr',
  color: '#000000',
  background: '#ffffff',
  title: 'My QR code',
  message: 'Scan it with your camera.',
  height: 150,
  lineWidth: 2 // Only applies to barcodes
};

Fliplet.Barcode.show('https://fliplet.com', options)
  .catch(function (error) {
    // Encoding failed
    console.log(error);
  });
Was this article helpful?
YesNo