ZPL Viewer (render ZPL to PNG / PDF) API

Render Zebra ZPL II label code to PNG or a multi-page PDF at 6 / 8 / 12 / 24 dpmm: text with Vietnamese, boxes, Code 128, EAN-13, Code 39, QR, ^GF images.

GETPOSThttps://apibox.io.vn/v1/zpl-render
Images & Codes▶ Try it online

Send ZPL (one or many ^XA … ^XZ labels) with the printer density dpmm (6, 8 = 203 dpi default, 12 = 300 dpi, 24) and the label size in inches (width 4, height 6 by default; ^PW / ^LL in the code win when smaller), and get a PNG per label (JSON), one label as PNG (format=png, index), or all labels as a PDF whose pages have the real label size (format=pdf), ready for a laser printer or a PDF viewer.

Supported commands: ^FO ^FT ^LH ^PW ^LL ^LR ^A / ^CF (font 0 scalable, bitmap fonts A–H, orientations N / R / I / B) ^FW ^FB (wrapping, justification, max lines) ^FD ^FV ^FS ^FH (hex escapes) ^FR (reverse) ^GB (boxes, lines, rounding) ^GC ^GE ^GD ^GF (ASCII hex, with ZPL compression) ^BY ^BC (Code 128) ^B3 (Code 39) ^BE (EAN-13) ^BQ (QR) ^CI28 (UTF-8: Vietnamese prints) ^PQ ^FX. Unsupported commands are listed in warnings (DataMatrix and PDF417 are drawn as placeholders).

Fonts are open substitutes (Be Vietnam Pro for font 0, JetBrains Mono for the bitmap fonts), so text widths differ slightly from a Zebra printer; positions, boxes and barcodes are exact dots. Up to 50 labels per request.

Markdown · OpenAPI · Postman · llms.txt

Parameters

NameInTypeRequiredDefault
zplbody|querystringyesZPL code (or a raw text body / file). Max 3 MB, 50 labels.
dpmmbody|querynumberno8Printer density: 6, 8, 12 or 24 dots per mm.
widthbody|querynumberno4Label width in inches.
heightbody|querynumberno6Label height in inches.
formatbody|querystringnojsonjson (PNG per label), png (one label) or pdf (all labels).
indexbody|querynumbernoRender only this label (1-based).

Example

curl -X POST "https://apibox.io.vn/v1/zpl-render" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"zpl":"^XA\n^FO40,40^A0N,40,40^FDXin chào^FS\n^FO40,100^BY2^BCN,80,Y,N,N^FD12345678^FS\n^XZ","width":2,"height":1}'

Response

{
  "label_count": 1,
  "dpmm": 8,
  "dpi": 203,
  "labels": [
    {
      "index": 1,
      "width": 406,
      "height": 203,
      "fields": 2,
      "copies": 1,
      "png": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZYAAADLCAAAAA…"
    }
  ],
  "warnings": []
}

Use cases

  • Preview carrier labels (DHL, FedEx, UPS, GHN) returned as ZPL before printing
  • Print ZPL labels on an office laser printer through the PDF output
  • Show label previews in a WMS or e-commerce back office
  • Test ZPL templates in CI without a physical printer

FAQ

Is the output pixel-identical to a Zebra printer?

Boxes, positions and barcodes are; text uses open fonts with similar metrics, so line breaks can differ slightly.

Does it print Vietnamese?

Yes, with ^CI28 (UTF-8) the text is drawn with a full Vietnamese font. Real printers need a Unicode font loaded for the same result.

Which barcodes are supported?

Code 128, Code 39, EAN-13 and QR. Other symbologies are reported in warnings and drawn as an empty box.

Related APIs

Start with 1,000 free requests every month. Get free API key →