Skip to content

Barcode

Prints a one-dimensional barcode using one of the supported ESC/POS symbologies.

Content may use at most 256 bytes after CP437 encoding. The selected format determines its other character and length rules. CODE128 content must begin with the code-set prefix {A, {B, or {C.

Example

{
  "type": "barcode",
  "format": "CODE128",
  "content": "{B1234567890",
  "align": "center",
  "hriPosition": "bottom"
}

Fields

FieldTypeDescription
typerequired"barcode"

Discriminator for barcode blocks.

formatrequiredstring

Barcode symbology. The selected format determines the allowed character set and length.

  • Allowed: "UPC-A", "UPC-E", "JAN13", "JAN8", "CODE39", "ITF", "CODABAR", "CODE93", "CODE128", "GS1-128", "GS1 (DataBar Omnidirectional)", "GS1 (DataBar Truncated)", "GS1 (DataBar Limited)", "GS1 (DataBar Expanded)"
contentrequiredstring

Data to encode in the barcode. Must be at most 256 bytes after CP437 encoding; other character and length rules depend on the selected format.

  • Minimum length: 1
alignoptionalstring

Horizontal alignment of the printed barcode.

  • Allowed: "left", "center", "right"
hriPositionoptionalstring

Human-readable interpretation text position relative to the barcode.

  • Allowed: "none", "top", "bottom", "top-bottom"
hriFontoptionalstring

Font used for the human-readable interpretation text.

  • Allowed: "A", "B", "C", "D", "E", "special-A", "special-B"
widthoptional1 | 2 | 3 | 4 | 5 | 6

Width of the narrowest barcode bar in printer dots. Larger values produce wider barcodes.

heightoptionalinteger

Height of the barcode in printer dots.

  • Minimum: 1
  • Maximum: 255