^GD
Graphic Diagonal LinePreview: partialDraws a diagonal line across a rectangular field, with selectable rising or falling lean.
Syntax
^GDw,h,t,c,oParameters
| Parameter | Description and accepted values | If omitted |
|---|---|---|
| w | Field width in dots.Thickness to 32000 dots — width | Value of t |
| h | Field height in dots.Thickness to 32000 dots — height | Value of t |
| t | Line thickness in dots.1 to 32000 dots — line thickness | 1 dot |
| c | B draws black; W draws white.B black or W white | B |
| o | R connects bottom-left to top-right; L connects top-left to bottom-right.R rising right or L falling right | R |
How it works
^GD draws one diagonal inside the supplied width and height. The lean chooses which pair of opposite corners the line connects, while thickness controls the stroke.
Its rectangle is placed as a graphic field: ^FO anchors its top edge and ^FT anchors its bottom edge. This is useful for slashes and cancellation marks without calculating endpoints.
Keep width and height explicit when diagonals must align with boxes. A zero side falls back to the thickness and creates a small mark.
Example
ZPL
^XA
^FO80,50^GD180,100,4,B,R^FS
^XZRendering…
How the preview on this site handles it
The preview draws the selected diagonal, including ^FO/^FT and ^FR placement. ^GD has no orientation parameter, so ^FW does not rotate it.
Common mistakes
- Using the wrong lean.
- Leaving out ^FS.
- Relying on ^FW for rotation.