The barcode component formats a barcode, by default in a CODE128 format.

To format a barcode, use:

<div class="barcode" data-options="options">value</div>

value is the value to be formatted.

options is a JSON string containing options.

Options is optional: here is an example of a default barcode.

The barcode component is a wrapper to the JsBarcode component - see the component for a list of options. The valid option, which requires a function, is not suppored.

The barcode is generated as a responsive image, i.e. its width will be constrained by the surrounding div.

The barcode would typically be generated within an extension script, using code something like this:

var barcodeValue = '1234';
var barcodeOptions = {
format: 'pharmacode', lineColor: '#0aa', width: 4, height: 40, displayValue: false }
s += '<div class="barcode" data-options="' +
application.escape(application.stringify(options)) + '">' +
application.escape(barcodeValue) + '</div>';

This would give a barcode like this:

Different barcode formats have different restrictions on the values that can be shown. If the barcode does not show, look in the browser's console for a message.