跳到内容

A missing ^FS makes a ZPL field disappear

Every ZPL field ends with ^FS; without it the field stays open and the next field's commands are applied to it. In the OpenZPL engine the unclosed field is lost or drawn at the next field's position, so add ^FS after every ^FD and after every ^GB.

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

Open in the viewer

What you see

A text line is missing, or two fields print in the same place, or a field shows up where a different field should be. The ZPL looks right at a glance.

No ^FS after the first ^FD

Only the line AUSTIN, TX 78701 prints; the name is missing
4 × 2 in label at 203 dpi (8 dpmm) · 812 × 406 px · Open in the viewer
^XA
^FO40,40^A0N,45,45^FDALEX MORGAN
^FO40,110^A0N,45,45^FDAUSTIN, TX 78701^FS
^XZ

^FS after each field

Both lines print: ALEX MORGAN and AUSTIN, TX 78701
4 × 2 in label at 203 dpi (8 dpmm) · 812 × 406 px · Open in the viewer
^XA
^FO40,40^A0N,45,45^FDALEX MORGAN^FS
^FO40,110^A0N,45,45^FDAUSTIN, TX 78701^FS
^XZ

Why it happens

A field in ZPL is everything from ^FO to ^FS: position, font, data. ^FS tells the printer the field is complete and can be drawn. Without it, the commands that follow still belong to the open field: the next ^FO moves it, the next ^A changes its font and the next ^FD replaces its data.

In the label above, the first field never closes. The second ^FO and ^FD take it over, so only AUSTIN, TX 78701 prints and ALEX MORGAN is gone. When the next field is a box, the result is different: the text moves to the box's position and overlaps whatever is there.

The name printed lower than intended, on the line and overlapping the next field
4 × 2 in label at 203 dpi (8 dpmm) · 812 × 406 px · Open in the viewer
^XA
^FO40,40^A0N,45,45^FDALEX MORGAN
^FO40,100^GB700,4,4^FS
^FO40,130^A0N,45,45^FDAUSTIN^FS
^XZ

What exactly happens depends on what follows the missing ^FS, which is why the symptom varies: a missing line, a line in the wrong place, or text in the wrong font.

The fix

End every field with ^FS, including boxes and lines drawn with ^GB and barcodes. A good habit is one field per line in the file, each ending in ^FS:

^FO40,40^A0N,45,45^FDALEX MORGAN^FS
^FO40,110^A0N,45,45^FDAUSTIN, TX 78701^FS

How to check

  • Count ^FD and ^FS: every ^FD needs its own ^FS before the next ^FO or ^FT.
  • Templates are the usual suspect: a conditional block that adds a field but leaves out its ^FS when a value is empty.
  • In the ZPL viewer, a field that disappears when you add the next one is missing its ^FS.

The engine and the printer parse the field structure the same way, so a missing ^FS that shows in the preview will show on paper too. Exact results with several open fields can differ between firmware versions: fix the ZPL rather than relying on what happens.

问题

Is ^FS needed after ^GB boxes and lines?

Yes. A box is a field like any other: ^FO50,50^GB300,100,3^FS. Without ^FS the next field inherits the box's position.

Can I put ^FS on the next line?

Yes, line breaks between commands are ignored. But a line break inside ^FD data is part of the data, so keep ^FD...^FS on one line.

Sources