Guides

Command line

Render, preview, lint, convert, view and print ZPL labels from a terminal with the zplkit command.

@zplkit/cli is the zplkit command. It needs Node 22 or newer.

Installing

Run it without installing anything:

npx @zplkit/cli render label.zpl

With pnpm, Yarn or Bun, that's pnpm dlx @zplkit/cli, yarn dlx @zplkit/cli or bunx @zplkit/cli.

To have the zplkit command everywhere, install it globally:

npm install --global @zplkit/cli
zplkit render label.zpl

Or add it to a project, for example to lint its labels in CI:

npm install --save-dev @zplkit/cli
npx zplkit lint labels/*.zpl

Every command reads a file, or standard input when the file is -.

render

Renders each label to a PNG, with zplkit's own renderer. The size comes from ^PW and ^LL, or --width and --height; the resolution from --dpi (203 if not given).

zplkit render label.zpl                      # label.png
zplkit render label.zpl -o out.png --dpi 300 # out.png at 300 dpi
zplkit render label.zpl --width 4in --height 2in
cat label.zpl | zplkit render - -o label.png # from standard input

Labels with serial numbers (^SN, ^SF) render one PNG per copy, like label-1.png, label-2.png; --limit 10 renders the first ten. Copies that are all the same render once. --clock 2026-10-28T08:00 sets the time for ^FC dates, and --smooth smooths edges instead of drawing the printer's exact dots.

preview

Renders the labels into a temporary folder and opens them in your image viewer, like Preview on macOS or Photos on Windows, without a browser or a network connection. It takes the same options as render, and opens the first 5 different labels unless --limit says otherwise.

zplkit preview label.zpl --dpi 300

lint

Lists problems the printer won't report, with their line and column. It exits with 1 when there's an error, or any problem with --strict, so it can check labels in CI.

zplkit lint labels/*.zpl
# labels/box.zpl:3:1  warning  ^PM stays on for the labels printed after this one…  setting-kept-after-label

convert

Turns ZPL into zplkit code: JSX, or builder calls with --style builder.

zplkit convert label.zpl --style builder > label.ts

format

Puts each field and setting on its own line, with a blank line between labels, so long one-line ZPL is easy to read. Printers ignore line breaks, so the labels print the same. It prints the result; --write rewrites the files instead and names the ones it changed.

zplkit format label.zpl
zplkit format labels/*.zpl --write

view

Opens the label in the viewer, formatted. The ZPL goes in the link, after the #, so it isn't sent to a server. --no-open only prints the link.

Sends labels to a network printer on port 9100, or another port after a colon. It asks the printer's status first and sends nothing if it isn't ready; --no-check skips that. status only asks.

zplkit print label.zpl --printer 192.168.1.50
zplkit status --printer printer.local:6101
# printer.local isn't ready: out of labels

Run zplkit --help for every option.