^GD Graphic Diagonal Line

Graphic shapes ZPL caret command

Draws a straight diagonal line inside a box of given width and height, leaning right or left.

Format ^GDw,h,t,c,o

^GD parameters

Parameters of ^GD
ParameterMeaningAccepted valuesDefault
wbox width (in dots)p. 213

The width of the box the diagonal spans.

3 to 32000 dots

The value of the thickness t, or 3.

hbox height (in dots)p. 213

The height of the box the diagonal spans.

3 to 32000 dots

The value of the thickness t, or 3.

tborder thickness (in dots)p. 213

The thickness of the line.

1 to 32000 dots

1
cline colorp. 213

The color of the line.

  • Bblack
  • Wwhite
B
oorientation (direction of the diagonal)p. 213

Which way the diagonal leans.

  • R or /Right-leaning diagonal.
  • \Left-leaning diagonal. The guide prints the backslash but no letter for this value.
R

^GD notes and gotchas

  • Note

    The guide says the command can be combined with other graphic commands to build more complex figures; its example draws a diagonal across a box made with ^GB.

    p. 213
  • Note

    The width and height are labeled 'box width' and 'box height' even though the command draws a line; the guide's example describes the line as joining opposite corners of a box.

    p. 213
  • Guide issue

    The value list for o prints 'R (or /) = right-leaning diagonal (or \) = left-leaning diagonal'. The identifying letter for the left-leaning case is missing from the printed entry, so the record gives only the backslash and does not supply a letter.

    p. 213

^GD example

example.zplZPL
^XA
^FO50,50^GD300,150,5,B,R^FS
^XZ

A right-leaning diagonal in a 300 by 150 dot area, 5 dots thick, black, with its field origin at 50 dots from the left and 50 dots down.

Guides that use ^GD

BarcoderX is a .NET SDK for thermal labels and barcodes. See how it prints and exports labels.

Source Zebra, ZPL II, ZBI 2, Set-Get-Do, Mirror, WML Programming Guide, P1134473-11EN Rev A, 2026/07/05, pages 201, 204, 210, 213.

Written by BarcoderX in its own words. Checked against the guide on 2026-11-14.

ZPL and ZPL II are trademarks of Zebra Technologies Corporation. This reference is written by BarcoderX in its own words from Zebra's published programming guide. BarcoderX is an independent product and is not affiliated with, endorsed by or sponsored by Zebra Technologies.