Skip to content
Johan Lindell edited this page Apr 24, 2016 · 24 revisions

Width (default: 2)

The width option is the width of a single bar.

Examples:
JsBarcode("#barcode", "Smallest width", {
  width: 1
});

JsBarcode("#barcode", "Wider barcode", {
  width: 3
});
Result:

Smallest width Wider barcode

Height (default: 100)

The height of the barcode.

Examples:
JsBarcode("#barcode", "Wider barcode", {
  height: 150
});

JsBarcode("#barcode", "Smallest width", {
  height: 25
});
Result:

Tall barcode Short barcode

Format (default: "auto" (CODE128))

Select which barcode type to use. Please check the wikipage of the different barcode types for more information.

Examples:
JsBarcode("#barcode", "123456789012", {
  format: "EAN13"
});

JsBarcode("#barcode", "123456789012", {
  format: "CODE39"
});
Result:

EAN13 CODE39

Font Options (default: "")

With fontOptions you can add bold or italic text to the barcode.

Examples:
JsBarcode("#barcode", "Bold text", {
  fontOptions: "bold"
});

JsBarcode("#barcode", "Italic text", {
  fontOptions: "italic"
});

JsBarcode("#barcode", "Both options", {
  fontOptions: "bold italic"
});
Result:

Bold text Italic text Both options

Font (default: "monospace")

Define the font used for the text in the generated barcode. This can be any default font or a font defined by a @font-face rule.

Examples:
JsBarcode("#barcode", "Fantasy font", {
  font: "fantasy"
});
Result:

Fantasy font

Clone this wiki locally