The ^GB command renders a graphic box (rectangle) on the label. By varying the width, height, and border thickness you can draw horizontal rules, vertical rules, solid filled rectangles, or hollow outlined boxes.
When the border thickness equals the smaller of the width or height, the box becomes fully filled. For example, ^GB400,3,3 draws a solid horizontal rule 400 dots wide and 3 dots tall.
The corner rounding parameter (r) smooths corners from 0 (sharp) to 8 (maximum rounding — nearly circular for square boxes).
^GB is commonly used for section dividers, borders around fields, and decorative label structure. Combined with ^FR (field reverse), you can create white-on-black areas.
Syntax
^GBw,h,t[,c,r]
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
| w | integer | optional | Box width in dots. |
| h | integer | optional | Box height in dots. |
| t | integer | optional | Border thickness in dots. Set equal to min(w,h) for a solid filled box. |
| c | B | W | B | Border color: B = black, W = white. |
| r | 0–8 | 0 | Corner rounding: 0 = square corners, 8 = maximum rounding. |
Examples
Horizontal divider line
Try in Viewer^XA ^FO50,30^A0N,36,36^FDSection Header^FS ^FO50,80^GB400,3,3^FS ^FO50,95^A0N,28,28^FDContent below the line^FS ^XZ
Outlined box with rounded corners
Try in Viewer^XA ^FO30,30^GB440,150,4,,4^FS ^FO50,60^A0N,36,36^FDBoxed Text^FS ^FO50,105^A0N,26,26^FDWith a rounded border^FS ^XZ
Common Mistakes
- !Setting thickness (t) greater than width or height — the printer may ignore the command or render unexpectedly.
- !Forgetting that ^GB needs a ^FO before it — like all field-based commands, it needs a position.
- !Confusing ^GB (box) with ^GC (circle) and ^GD (diagonal) — each takes different parameters.