ZPLToolkit

^XG

Recall GraphicPreview: partial

Draws a bitmap that was downloaded to the printer once, instead of resending it with every label.

Syntax

^XGd:o.x,mx,my

Parameters

ParameterDescription and accepted valuesIf omitted
d:o.xDevice, name and extension of the stored graphic, as in R:LOGO.GRF.Device, name and extension of the stored graphicR:, .GRF
mxHorizontal magnification, 1 to 10.1 to 10 — horizontal magnification1
myVertical magnification, 1 to 10.1 to 10 — vertical magnification1

How it works

A logo does not change between labels, so sending it inside each one wastes the link. ~DG stores the bitmap on the printer under a name, and ^XG draws it — the format that follows carries a few dozen bytes where it used to carry hundreds of kilobytes.

The name is a device, a file name and an extension, as in R:LOGO.GRF. The device and the extension can be left off; R: and .GRF are what the printer assumes.

The two magnification parameters repeat dots rather than resampling, so a stored image doubles cleanly but never gains detail. Store the graphic at the size you mean to print it, and use magnification only for deliberate blocky scaling.

Example

ZPL
~DGR:SQUARE.GRF,32,2,FFFFC003A0059009881184218241818181818241842188119009A005C003FFFF
^XA
^FO40,40^XGR:SQUARE.GRF,2,2^FS
^XZ

Rendering…

A 16 × 16 dot bitmap downloaded once, then recalled at double size.
Open in the viewer

How the preview on this site handles it

The preview keeps the graphics a ~DG in the same paste downloaded, and draws them with the requested magnification. A name this preview never saw a ~DG for draws nothing, because the image lives on the printer and not in the format.

Common mistakes

  • Recalling a name that was never downloaded. The printer draws nothing and reports no error, which is why a missing logo is so hard to spot.
  • Assuming the store survives a power cycle. R: is volatile memory; use E: for a graphic that has to outlive the reboot.
  • Magnifying a small graphic to fill a space. Dots are repeated, so the edges go blocky — store it at the size you need.

See also