Skip to main content

ZPL how-to

Font size in ZPL

ZPL sizes text in dots, not points, and a font set with ^CF stays set for every field after it.

In plain ZPL

zpl
^XA
^FO40,40^A0N,80,80^FDBin A-12^FS
^FO40,160^A0N,34,34^FDShelf 3, left^FS
^XZ
  • ^A0N,80,80: font 0, normal orientation, 80 dots high and 80 wide. It applies to the next field only. Font 0 scales to any size; give it the same width as height for its normal shape, or a smaller width to narrow it.
  • ^CF0,40 sets the default font for every field that follows, until the next ^CF. A field with no ^A of its own takes whatever the last ^CF set, which is easy to miss when you move a field.

Points to dots

Dots = points × dpi ÷ 72. A dot is 1/203 inch on a 203 dpi printer and 1/300 inch on a 300 dpi one, so the same ZPL prints smaller on a 300 dpi printer.

PointsDots at 203 dpiDots at 300 dpi
82333
102842
123450
185175
2468100

The same label with zeepler

Send this body to POST https://api.zeepler.com/v1/zeeplify with your API key in the x-api-key header. It is a working request, not an illustration: on every change, our tests run this same file through the API's code and compare the result with the ZPL below.

json
1{
2 "config": {
3 "size": "4x2"
4 },
5 "data": {
6 "title": "Bin A-12",
7 "detail": "Shelf 3, left",
8 "note": "Same size as the line above"
9 },
10 "templates": [
11 {
12 "type": "Text",
13 "dataPath": "title",
14 "coords": [40, 40],
15 "font": "0,80"
16 },
17 {
18 "type": "Text",
19 "dataPath": "detail",
20 "coords": [40, 160],
21 "font": "0,34"
22 },
23 {
24 "type": "Text",
25 "dataPath": "note",
26 "coords": [40, 220]
27 }
28 ]
29}

And the ZPL that comes back, ready to send to the printer:

zpl
^XA^MCY^XZ
    ^XA
    ^SZ2
    ^MMT
    ^MNY
    ^LL406
    ^PW812
    ^LH0,0
^CF0,80^FO40,40^FDBin A-12^FS
^CF0,34^FO40,160^FDShelf 3, left^FS
^FO40,220^FDSame size as the line above^FS
^XZ

font becomes a ^CF before the field, so it carries over the same way: the third line has no font and prints at 34 dots, like the line above it. Give every Text element a font if you want each one to stay the size you chose when you reorder them.

Sending it

  • Call the API from your own server or integration engine, not from a web page. An API key in a browser is a key anyone can copy.
  • A successful call answers 200 with the ZPL as plain text. A request the API cannot turn into a label answers 400 with every problem listed by field, and is not billed.
  • Send the ZPL to a Zebra or other ZPL printer at 203 dpi. At 300 dpi the same label prints at two-thirds of the size.

The API reference has every field and status code.

Before you go live

  • Text does not wrap. A value longer than the space you left runs off the edge of the label, so set maxLength on any field whose length you do not control.
  • Coordinates are in dots from the top-left corner. Print one label, measure it, and adjust: there is no preview.
  • Scan every barcode and QR code on a printed label before relying on it.

Related guides

Help with an integration

Email info@zeepler.com. You will get a reply within 2 business days. The support policy covers response times and version changes.