Generating barcode images using various encoding methods
The Kendo UI library provides APIs that can be used to generate the barcode graphic image for the given value. For example, each product in the supermarket can have a barcode associated with it. When a customer purchases the product, the barcode would be used to get the product price and other details. The library can generate the barcode by referring to the unique identifier.
How to do it…
A barcode image can be generated by invoking the kendoBarcode
function on the DOM element:
$("#chart").kendoBarcode({ value: '1234567' });
Here, the 1234567
value will be encoded using the default encoding, that is, code39
. You can also specify the encoding method to be used by specifying the type
field:
$("#chart").kendoBarcode({ value: '1234567', type: 'ean8' });
In the preceding code snippet, the encoding type is set to ean8
. The other possible values are EAN13
, UPCE
, UPCA
, Code11
, Code39
, Code39Extended
, Code93
, Code93Extended
, Code128
, Code128A...