ZPLRenderer
ZPL Renderer is a desktop application that interprets ZPL (Zebra Programming Language) commands and renders them as a visual preview of what a label will look like when printed on a physical Zebra printer. It is a companion tool to Commander4j, LabelServer4j, and AutoLab4j.
Purpose
ZPL is a text-based command language used to define label layouts, text, graphics, and barcodes for Zebra label printers. The commands are sent directly to the printer as a stream of characters and are not human-readable. ZPL Renderer allows you to:
- Load a ZPL file and see what the label will look like before sending it to a printer
- Listen on a network socket so that any application sending ZPL to that port renders the label on screen in real time
- Zoom in and out to examine label detail
- Preview multiple labels from a single ZPL stream
- Export the rendered label to PDF
- Print the rendered label directly from the application
Running ZPL Renderer
ZPL Renderer is a Java 21 desktop (Swing) application:
java -jar zplrenderer.jar
On first launch it reads its configuration from xml/config/config.xml.
Loading a ZPL File
Use the Open toolbar button to load a .zpl text file from disk. The label is rendered immediately. Use Refresh to reload the file after editing it externally.
Several example ZPL files are included in the examples/ directory:
| File | Contents |
|---|---|
| example1.zpl | Shipping label with QR code, text, and graphics |
| example2.zpl | Complex layout with boxes, barcodes, and logo |
| barcodes.zpl | Showcase of all supported barcode types |
| pallet_labels.zpl | Pallet label examples typical of Commander4j output |
| fonts.zpl | Font size and style demonstration |
| shipping.zpl | Shipping label sample |
| character.zpl | Character set reference |
| grid.zpl | Layout grid for alignment reference |
Network Socket Mode
ZPL Renderer can listen on a TCP/IP port and render any ZPL label stream sent to it. This allows Commander4j, LabelServer4j, or any other application to use ZPL Renderer as a virtual printer — sending ZPL to the socket and seeing the result on screen instead of printing to paper.
The default port is 9100 (the standard Zebra raw print port). The IP address and port are configured in config.xml. Enable listening using the Network button in the toolbar.
ZPL Renderer extracts complete label blocks from the stream, identified by the standard ^XA (start of label) and ^XZ (end of label) delimiters.
Zoom
Use the zoom controls in the toolbar to scale the rendered label between 0.10× and 2.00×. The default zoom is configured in config.xml (default: 0.5×). This is useful for examining barcode detail or checking overall label proportions.
Multiple Labels
When a ZPL file or network stream contains multiple labels, ZPL Renderer displays them as pages. Navigation controls allow stepping through each label. The maximum number of pages displayed is configurable (default: 3).
Export and Print
- PDF Export — saves the rendered label as a vector PDF using Apache PDFBox
- Print — sends the rendered label to a system printer
Supported ZPL Commands
ZPL Renderer supports over 100 ZPL commands. Key categories:
Label Setup
| Command | Description |
|---|---|
| ^XA | Start of label |
| ^XZ | End of label |
| ^LL | Label length |
| ^LH | Label home (origin offset) |
| ^LT | Label top offset |
| ^PQ | Print quantity |
| ^CD | Change delimiter character |
| ^CC | Change caret character |
Text and Fields
| Command | Description |
|---|---|
| ^FO | Field origin (X,Y position from top-left) |
| ^FT | Field typeset (X,Y position from bottom-left) |
| ^FD | Field data (the text content) |
| ^FS | Field separator |
| ^FR | Field reverse (inverted colours) |
| ^FW | Field orientation/rotation |
| ^FX | Comment (ignored in output) |
Fonts
| Command | Description |
|---|---|
| ^A0–^AZ | Select font by ID |
| ^CF | Change default alphanumeric font |
| ^CI | Change international character set/encoding |
Graphics
| Command | Description |
|---|---|
| ^GB | Graphic box (rectangle) |
| ^GC | Graphic circle |
| ^GD | Graphic diagonal line |
| ^GE | Graphic ellipse |
| ^GF | Graphic field (embedded image data) |
| ^GS | Graphic symbol |
Barcodes
| Command | Description |
|---|---|
| ^BC | Code 128 / GS1-128 (EAN-128) |
| ^BE | EAN-13 |
| ^B8 | EAN-8 |
| ^B3 | Code 39 |
| ^B2 | Interleaved 2 of 5 |
| ^B1 | Code 11 |
| ^BQ | QR Code |
| ^B7 | PDF417 |
| ^B0 / ^BO | Aztec |
| ^BY | Bar code field defaults (width, ratio, height) |
Barcode rendering uses the OkapiBarcode library. GS1 application identifiers are interpreted from xml/config/gs1_app_defs.xml.
Configuration
config.xml
Located at xml/config/config.xml:
| Setting | Description |
|---|---|
| Input folder | Default directory for ZPL file loading (default: ./examples)
|
| Port | Network socket port to listen on (default: 9100) |
| Default magnification | Starting zoom level (default: 0.5) |
| Max pages | Maximum number of label pages to display (default: 3) |
fonts.xml
Located at xml/config/fonts.xml, this file maps ZPL font IDs (0, A–Z) to TrueType font files and defines their pixel dimensions. This allows ZPL Renderer to simulate the fonts installed in a physical Zebra printer.
Included fonts: Bitstream Vera, Anonymous Pro, ATTriumvirate.
If your labels use fonts that differ from the defaults, edit fonts.xml to match the font metrics of your target printer.
Relationship to Commander4j
Commander4j generates ZPL label streams for pallet and case labels. ZPL Renderer allows you to preview these labels before deploying them to production printers, and to verify that label templates produce the correct output after making changes to the template syntax. See Label Template Syntax and Zebra ZPL Label for information on ZPL label authoring within Commander4j.
See also: Zebra ZPL Label, Label Template Syntax, Printer Queues, Production Lines & Labellers