ZPLToolkit

^GD

Graphic Diagonal LinePreview: partial

Draws a diagonal line across a rectangular field, with selectable rising or falling lean.

Syntax

^GDw,h,t,c,o

Parameters

ParameterDescription and accepted valuesIf omitted
wField width in dots.Thickness to 32000 dots — widthValue of t
hField height in dots.Thickness to 32000 dots — heightValue of t
tLine thickness in dots.1 to 32000 dots — line thickness1 dot
cB draws black; W draws white.B black or W whiteB
oR connects bottom-left to top-right; L connects top-left to bottom-right.R rising right or L falling rightR

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
^XZ

Rendering…

A rising-right diagonal across a 180 by 100 dot field.
Open in the viewer

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.

See also