Get started with jsbarcode CDN

MIT licensed

JsBarcode is a lightweight library for generating dynamic QR codes and DataMatrix codes.

Tags:
  • barcode
  • canvas
  • code128
  • upc
  • ean
  • itf
  • msi
  • pharmacode

Stable version

Copied!

How to start using jsbarcode CDN


// Include the library using the CDN link
const script = document.createElement('script');
script.src = 'https://cdn.cdnhub.io/jsbarcode/3.11.6/JsBarcode.all.min.js';
document.head.appendChild(script);

// Wait for the library to load before generating the barcode
JsBarcode.init();

// Generate a barcode with the value "123456" and print it to the element with id "barcodeContainer"
JsBarcode("barcodeContainer", "123456", {
  format: "code128", // You can change the barcode format here
  label: "Label text", // You can add a label text here
  displayText: false, // Hide the text below the barcode
  width: 2, // Barcode width in pixels
  height: 50, // Barcode height in pixels
});
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!

All versions