Command line

The labelviewer executable also renders from the command line: labelviewer render writes the same PNGs as the HTTP routes, without a server. Installing it is described in Install.

Examples#

labelviewer render label.zpl -o label.png --dpmm 8 --width 4 --height 6
cat labels.zpl | labelviewer render - -o out/ --index 2
labelviewer merge template.zpl data.json | labelviewer render - -o out/   # fill a template, then render every copy

On Windows use labelviewer.exe the same way.

With Docker (<container> = your container's name), the ZPL goes in on standard input and the PNG is copied out:

docker exec -i <container> labelviewer render - -o /tmp/label.png < label.zpl
docker cp <container>:/tmp/label.png .

A read-only container has no writable /tmp; run a one-off container with a mounted directory instead: docker run --rm -v "$PWD:/work" -w /work labelviewer:1.0.1 render label.zpl -o label.png (the directory must be writable by uid 10001).

Options#

labelviewer render <file.zpl|-> [-o out.png|outdir] [--dpmm 8] [--width 4] [--height 6] [--index n]
OptionDefault
<file.zpl> or -The ZPL file, or - to read standard input.
-o, --outthe current directoryA .png file or a directory. With several labels, a .png path becomes <name>-N.png and a directory gets label-N.png (N is 0-based).
--dpmm86, 8, 12 or 24 (152, 203, 300, 600 dpi), as in Choosing the density and size.
--width, --height4, 6Label size in inches.
--indexevery labelRender only label n (0-based).

Warnings (for example Unsupported command ^XY) go to standard error. Exit status: 0 = ok, 1 = render error, 2 = usage error, 3 = not licensed (the license does not cover the Viewer, has expired or is not valid; the message says what to do, see License). On a trial license the PNGs are watermarked. labelviewer render --help prints the options.