Conversão de linguagens de impressora
Convert TSPL to ZPL: command equivalents and migration guide (TSC → Zebra)
How TSPL commands translate to ZPL, the traps in units, fonts and barcode widths, a real before/after label, and how to bring a TSC label library to Zebra printers.
Este artigo está disponível em inglês e espanhol.
The reverse migration happens when a company standardizes on Zebra for its industrial lines, inherits TSC labels from an acquisition, or must deliver ZPL because a customer's WMS sends it straight to the printer. TSPL is a friendlier language to read, so the translation to ZPL is mostly about respecting ZPL's stricter structure: everything inside ^XA…^XZ, every field opened with ^FO and closed with ^FS.
Command equivalents
| Operation | TSPL (TSC) | ZPL (Zebra) |
|---|---|---|
| Start / end of label | CLS … PRINT 1 | ^XA … ^XZ |
| Label size | SIZE 100 mm,75 mm GAP 3 mm,0 | ^PW800 ^LL600 (dots) |
| Field position | First two parameters of TEXT/BARCODE (x,y in dots) | ^FO50,40 (x,y in dots) |
| Text | TEXT 50,40,"0",0,12,12,"Hello" | ^A0N,40,40 ^FDHello^FS |
| Code 128 | BARCODE 50,150,"128",80,1,0,2,4,"12345" | ^BY2 ^BCN,80,Y,N,N ^FD12345^FS |
| QR code | QRCODE 400,150,M,6,A,0,"data" | ^BQN,2,6 ^FDQA,data^FS |
| Data Matrix | DMATRIX 400,150,120,120,"data" | ^BXN,6,200 ^FDdata^FS |
| Box / line | BOX x,y,xend,yend,2 / BAR x,y,w,h | ^GB300,2,2^FS |
| Copies | PRINT 10,1 | ^PQ10 |
| Darkness / speed | DENSITY 10 SPEED 4 | ^MD15 ^PR4 |
What actually changes
- Label size: TSPL's SIZE in millimeters becomes ^PW/^LL in dots — multiply by 8 at 203 dpi or 11.8 at 300 dpi and round.
- Fonts: TSPL bitmap fonts 1–8 have no ZPL twin; map them to ^A0 (scalable) with a height chosen to match the printed size, or to ^A fonts A–H for a bitmap look.
- Barcodes: TSPL's per-command narrow/wide widths become a single ^BY before the barcode; if two barcodes on the label use different widths you need two ^BY declarations.
- QR and Data Matrix: TSPL sizes them in cell width or in pixel dimensions; ZPL sizes by magnification (^BQ) or module (^BX). Verify the printed size, not the numbers.
- Rotation: TSPL rotates per field (0/90/180/270); ZPL uses ^FW for the whole label or the orientation letter in each ^A/^B command (N, R, I, B).
Before and after: the same label
SIZE 60 mm,40 mm GAP 2 mm,0 CLS TEXT 20,20,"3",0,1,1,"LOC-A01-03" BARCODE 20,60,"128",80,1,0,2,2,"LOCA0103" PRINT 1
^XA ^PW480 ^LL320 ^FO20,20 ^A0N,30,30 ^FDLOC-A01-03^FS ^FO20,60 ^BY2 ^BCN,80,Y,N,N ^FDLOCA0103^FS ^PQ1 ^XZ
Migration checklist
- Decide the target font strategy (scalable ^A0 vs bitmap ^A) once and apply it to the whole library for consistency.
- Check ^BY module width against the Zebra head resolution; a width that scanned on the TSC may be too narrow at 300 dpi.
- Replace TSPL BITMAP logos with ^GF or, preferably, with stored graphics (^DG) to keep jobs small.
- If the label is fed from a WMS that already speaks ZPL, keep variable fields in the same order to avoid remapping.
How EtikStudio does it
Import the TSPL job, correct anything visually, select a Zebra profile and export ZPL. Fonts are matched by printed metrics, ^BY is derived from the narrow bar width you had, and the human-readable line is regenerated from the same data field so the two never diverge.
Os exemplos de comandos são simplificados para clareza; a sintaxe exata varia por modelo e firmware. Sempre teste na impressora de destino.