跳到内容

4 × 2 in labels in ZPL

A 4 × 2 inch label (101.6 × 50.8 mm) is 812 × 406 dots at 203 dpi and 1219 × 609 dots at 300 dpi. Use ^PW812 and ^LL406 on a 203 dpi printer, and the size 4x2 in the API path.

已更新 2026-10-20 · Renders made with the OpenZPL engine

Open in the viewer

4 × 2 in at each print density

PrinterdpmmExact dpi^PW^LLdpi the API usesAPI image (px)
152 dpi6152.4609304152608 × 304
203 dpi8203.2812406203812 × 406
300 dpi12304.812196093041216 × 608
600 dpi24609.6243812196092436 × 1218

^PW and ^LL are the size in millimetres times the dots per millimetre, rounded down, because they take whole dots. The printer names round the density: a "300 dpi" printer prints 12 dots per millimetre, which is 304.8 dpi. The API sizes its image the way Labelary does: inches times a whole number of dots per inch (152, 203, 304 or 609), rounded down. That is why the image can be a dot or two smaller than ^PW and ^LL. Try other sizes with the label size calculator.

Starter template

4 × 2 in suits product, shelf and carton labels: room for a name, a price or quantity and a barcode. This template is laid out for 812 × 406 dots:

4 by 2 inch product label with name, SKU, price and Code 128 barcode
4 × 2 in label at 203 dpi (8 dpmm) · 812 × 406 px · Open in the viewer
^XA
^CI28
^PW812
^LL406
^FO30,30^A0N,48,48^FDThermal label rolls^FS
^FO30,88^A0N,28,28^FD4 x 6 in, 500 labels per roll^FS
^FO30,135^GB752,2,2^FS
^FO30,160^A0N,26,26^FDSKU^FS
^FO30,192^A0N,40,40^FDTLR46500^FS
^FO540,150^A0N,90,90^FD$24.90^FS
^BY2,3,110
^FO30,250^BCN,110,Y,N,N^FDTLR46500^FS
^XZ

The price is the widest element; with 90-dot text it ends near the right edge. If you lengthen it, move its ^FO left or lower the font size so it doesn't run off the label.

Coordinates in ZPL are dots, so a layout made for one density prints at another size on a different printer. See 203 vs 300 dpi before sending the same ZPL to both.

curl https://api.openzpl.com/v1/printers/8dpmm/labels/4x2/0/ \
  --data-binary @label.zpl > label.png

问题

What are ^PW and ^LL for a 4x2 label?

^PW812 and ^LL406 at 203 dpi; ^PW1219 and ^LL609 at 300 dpi.

Does ^LL matter on die-cut labels?

The printer usually finds the gap between die-cut labels itself; ^LL matters most on continuous media. Setting it anyway keeps the preview the right size.

Sources