# TSPL command reference

67 commands from the [canonical TSC Printer Language reference](https://rfid.me/reference/tspl/).

Schema version: 1

Reuse: No reuse license is granted by this export. Consult the upstream package or repository terms before reusing the data.

## CLS — Clear Image Buffer

Clears the image buffer before drawing a new label. Think of it as pressing "New Document" — it erases any previous content so you start fresh. Every label should begin with CLS after SIZE and GAP.

- Category: control
- Syntax: `CLS`
- Preview supported: yes
- Canonical HTML: https://rfid.me/reference/tspl/cls/

When to use: Always. Place it after SIZE and GAP to ensure a clean canvas before drawing.

Example:

```text
SIZE 100 mm, 60 mm
GAP 3 mm, 0 mm
CLS
TEXT 50,30,"4",0,1,1,"Hello"
PRINT 1
```

Clear the buffer before drawing a label

## PRINT — Print Label

Triggers printing of the label. The first parameter sets the number of label sets; the optional second sets the number of copies per set. This is always the last command in a TSPL label — like pressing "Print".

- Category: control
- Syntax: `PRINT qty[,copies]`
- Preview supported: yes
- Canonical HTML: https://rfid.me/reference/tspl/print/

When to use: Always. It is the very last command in every label. Without PRINT, nothing comes out of the printer.

Parameters:

- `qty`: Number of label sets to print (1-999999)
- `copies`: Number of copies per set (optional, default 1)

Example:

```text
SIZE 100 mm, 60 mm
GAP 3 mm, 0 mm
CLS
TEXT 50,30,"4",0,1,1,"Hello"
PRINT 1
```

Print one copy of the label

## FEED — Feed Label

Feeds the label stock forward by the specified number of dots. Useful for advancing past a label without printing, or for calibration.

- Category: control
- Syntax: `FEED n`
- Preview supported: yes
- Canonical HTML: https://rfid.me/reference/tspl/feed/

When to use: When you need to advance the media without printing — calibration, alignment, or skipping labels.

Parameters:

- `n`: Number of dots to feed forward

Example:

```text
FEED 100
```

Advance media by 100 dots

## BACKFEED — Backfeed Label

Feeds the media backward by `n` dots (TSPL2 PG §BACKFEED p22–23). Range 1–9999. Used to retract the label after printing so the tear-off or cutter position is correct. TSPL printers use the alias `BACKUP n` for the same semantic (BACKFEED is the TSPL2 spelling; BACKUP is the older TSPL one). Conversion: at 200 DPI, 1 mm = 8 dots; at 300 DPI, 1 mm = 12 dots. ⚠️ Inappropriate values can cause paper jam or media wrinkle.

- Category: control
- Syntax: `BACKFEED n`
- Preview supported: no
- Canonical HTML: https://rfid.me/reference/tspl/backfeed/

When to use: With tear-off or cutter modes when the label needs to retract to the correct tear/cut position after each print.

Parameters:

- `n`: Number of dots to back-feed (1–9999). Convert from mm: ×8 for 200 DPI printers, ×12 for 300 DPI.

Example:

```text
SIZE 100 mm, 50 mm
CLS
TEXT 50,30,"3",0,1,1,"Cut after"
PRINT 1
BACKFEED 50
```

Retract media by 50 dots after printing to align with the cutter

## FORMFEED — Form Feed

Advances the media to the start of the next label (TSPL2 PG §FORMFEED p24). The printer uses the GAP or BLINE sensor to detect the boundary and stops there. Takes no parameters. Runtime hardware behaviour; no SVG rendering effect.

- Category: control
- Syntax: `FORMFEED`
- Preview supported: no
- Canonical HTML: https://rfid.me/reference/tspl/formfeed/

When to use: When you need to skip to the next label without printing — useful for alignment, skipping damaged labels, or as part of a counter-driven sequence (the PG example chains FORMFEED with SET COUNTER, BOX, TEXT, PRINT).

Example:

```text
SIZE 100 mm, 50 mm
CLS
TEXT 50,30,"3",0,1,1,"Skip me"
FORMFEED
PRINT 1
```

Skip the current label without printing, then print the next one

## HOME — Home Position

Feeds the media until the internal sensor finds the next label origin (TSPL2 PG §HOME p25–26). Whether the printer back-feeds or feed-forwards to home depends on the per-model behaviour table on PG p25. Takes no parameters. ⚠️ `SIZE` and `GAP` (or `BLINE`) must have been issued first — HOME without prior geometry definition produces undefined behaviour. Runtime hardware behaviour; no SVG rendering effect.

- Category: control
- Syntax: `HOME`
- Preview supported: no
- Canonical HTML: https://rfid.me/reference/tspl/home/

When to use: At the start of a print run after power-on or after manual media-load, so the printer knows where the first label begins.

Example:

```text
SIZE 100 mm, 50 mm
GAP 3 mm, 0 mm
HOME
CLS
TEXT 50,30,"3",0,1,1,"After homing"
PRINT 1
```

Calibrate to the first label position after defining geometry

## SELFTEST — Self-Test Page

Triggers the printer to print a diagnostic page covering its current configuration, firmware version, dot/line counters, and sensor state (TSPL2 PG §SELFTEST p31). Takes no parameters. Per-printer support table on PG p31 lists which TTP / TDP / M23 series models honour the command. Runtime hardware behaviour; the playground can't simulate a real self-test page (output depends on live printer state and counters).

- Category: control
- Syntax: `SELFTEST`
- Preview supported: no
- Canonical HTML: https://rfid.me/reference/tspl/selftest/

When to use: Standalone diagnostic command — issue when you need to confirm printer settings, firmware, and sensor health without going through the front-panel menu.

Example:

```text
SELFTEST
```

Print a self-test diagnostic page

## INITIALPRINTER — Factory Reset

⚠️ Factory-reset opcode — clears all `SET *` settings, downloaded fonts/images, and stored programs. Takes no parameters. Not in the 2009 TSPL2 PG; appears in later TSC firmware addenda for the TX/TE/MH-series. On models that don't expose the opcode, the equivalent recovery procedure is "hold FEED during power-on" (per the DOWNLOAD section's AUTO.BAS-disable note on PG p81). Runtime hardware behaviour; no SVG rendering effect. Use with care — this is destructive and irreversible.

- Category: control
- Syntax: `INITIALPRINTER`
- Preview supported: no
- Canonical HTML: https://rfid.me/reference/tspl/initialprinter/

When to use: When you need to wipe a printer back to factory defaults — typically before re-deploying to a new site, or when troubleshooting requires a clean baseline. Avoid placing in production label scripts.

Example:

```text
INITIALPRINTER
```

Reset printer to factory defaults (clears SET settings, downloaded fonts, stored programs)

## EOP — End of Program

Marks the end of a stored program. When downloading label templates to the printer's memory, EOP signals where the program ends.

- Category: control
- Syntax: `EOP`
- Preview supported: no
- Canonical HTML: https://rfid.me/reference/tspl/eop/

When to use: When storing label templates in the printer's flash memory using DOWNLOAD.

Example:

```text
DOWNLOAD "LABEL.BAS"
SIZE 100 mm, 60 mm
GAP 3 mm, 0 mm
CLS
TEXT 50,30,"4",0,1,1,"Stored"
PRINT 1
EOP
```

Store a label program in the printer

## SIZE — Label Size

Sets the width and height of the label. You can specify the dimensions in mm (millimetres) or inch. This must be the first configuration command — it tells the printer how big the label is.

- Category: label
- Syntax: `SIZE w [unit], h [unit]`
- Preview supported: yes
- Canonical HTML: https://rfid.me/reference/tspl/size/

When to use: Always. It is the very first command in every TSPL label. Without SIZE, the printer does not know the label dimensions.

Parameters:

- `w`: Label width (numeric value)
- `h`: Label height (numeric value)
- `unit`: Unit: mm or inch (optional, default is mm)

Example:

```text
SIZE 100 mm, 60 mm
```

Set label size to 100mm wide by 60mm tall

## GAP — Gap Distance

Sets the gap distance between labels and the offset from the gap to the start of the printable area. The gap is the transparent space between die-cut labels on a roll.

- Category: label
- Syntax: `GAP gap [unit], offset [unit]`
- Preview supported: yes
- Canonical HTML: https://rfid.me/reference/tspl/gap/

When to use: Always for die-cut labels. Place it immediately after SIZE.

Parameters:

- `gap`: Gap distance between labels
- `offset`: Offset from gap edge to print area start
- `unit`: Unit: mm or inch (optional, default is mm)

Example:

```text
GAP 3 mm, 0 mm
```

Set 3mm gap between labels with no offset

## BLINE — Black-Mark Media Mode

Configures black-mark media mode and extra-feeding offset (TSPL2 PG §BLINE p8). Used instead of GAP for continuous media with black registration marks printed on the backing. `m` is the height of the black mark (0–1 inch, or 0–25.4 mm). `n` is extra label-feeding length after the mark (0 to label-length; `0,0` = continuous label). Two forms: bare numbers = inches; numbers followed by ` mm` (with a leading space) = millimetres. ⚠️ When changing the sensor type from "GAP" to "Black Mark", BLINE **must** be sent to the printer first — before SIZE / GAP / TEXT. Engine-recognised but no visible SVG effect today (the playground treats labels as already-isolated).

- Category: label
- Syntax: `BLINE m, n \| BLINE m mm, n mm`
- Preview supported: no
- Canonical HTML: https://rfid.me/reference/tspl/bline/

When to use: When the deployed media uses black-mark registration on the backing rather than die-cut gaps. Issue once at the top of the label script, before any geometry-dependent commands.

Parameters:

- `m`: Black-mark height. Bare number = inches (0–1); followed by ` mm` (with leading space) = millimetres (0–25.4).
- `n`: Extra label-feeding length after the black mark (0 to label-length; `0,0` means continuous label).

Example:

```text
BLINE 0.20, 0.50
SIZE 100 mm, 50 mm
CLS
TEXT 50,30,"3",0,1,1,"Black-mark stock"
PRINT 1
```

Configure black-mark media (0.20 inch mark, 0.50 inch extra feed) before defining label geometry

## REFERENCE — Reference Point

Sets the reference origin point for all coordinates on the label. All subsequent X,Y positions are relative to this point. It is like setting page margins — shifting the entire design.

- Category: label
- Syntax: `REFERENCE x, y`
- Preview supported: yes
- Canonical HTML: https://rfid.me/reference/tspl/reference/

When to use: When you need to offset the entire label design, for example to account for pre-printed stock or to reposition a layout without changing every coordinate.

Parameters:

- `x`: Horizontal reference offset in dots
- `y`: Vertical reference offset in dots

Example:

```text
REFERENCE 10, 10
```

Offset all coordinates by 10 dots in both directions

## DIRECTION — Print Direction

Sets the print direction. 0 = head moves forward (default), 1 = head moves backward. The optional second parameter mirrors the output.

- Category: label
- Syntax: `DIRECTION n[,m]`
- Preview supported: yes
- Canonical HTML: https://rfid.me/reference/tspl/direction/

When to use: When the label needs to print in a specific orientation — some applicator setups require reversed printing direction.

Parameters:

- `n`: Direction: 0 (forward) or 1 (backward)
- `m`: Mirror: 0 (normal) or 1 (mirror), optional

Example:

```text
DIRECTION 0
```

Set forward print direction

## OFFSET — Form-Feed Offset

⚠️ Despite the historical 'OFFSET' name, this is NOT a horizontal coordinate offset — for that, use REFERENCE (origin shift) or SHIFT (vertical translate). TSPL2 §OFFSET p9 defines it as the **selective extra label-feeding length** the printer takes on each form-feed, used in peel-off and cutter modes to adjust where the label stops. The printer back-tracks this extra length before the next print run. Range −1 ≤ m ≤ 1 (inch). Two forms: bare number = inches; followed by ` mm` (with leading space) = millimetres. ⚠️ An out-of-range or otherwise inappropriate value may cause a paper jam. Engine-recognised but no SVG effect today (playground does not simulate the feed/back-feed cycle).

- Category: label
- Syntax: `OFFSET m \| OFFSET m mm`
- Preview supported: no
- Canonical HTML: https://rfid.me/reference/tspl/offset/

When to use: Only with peel-off or cutter modes when the label stops a few mm short of (or past) the desired position after each print. Pair with `SET PEEL` or `SET CUTTER`.

Parameters:

- `m`: Extra feed distance. Bare number = inches (−1 to 1); followed by ` mm` (with leading space) = millimetres. Negative = back-feed (retract); positive = forward-feed.

Example:

```text
SET PEEL ON
OFFSET 0.1
SIZE 100 mm, 50 mm
CLS
TEXT 50,30,"3",0,1,1,"Peel-mode label"
PRINT 1
```

Add 0.1 inch extra feeding on each form-feed in peel-off mode

## TEXT — Text Field

Draws a text field at the specified position. You choose the font, rotation, and enlargement multipliers. TSPL combines position, font, and text data in a single command — unlike SBPL which uses separate commands for each.

- Category: text
- Syntax: `TEXT x,y,"font",rotation,x-mul,y-mul,"data"`
- Preview supported: yes
- Canonical HTML: https://rfid.me/reference/tspl/text/

When to use: Whenever you need to print text on the label. This is the primary text command in TSPL.

Parameters:

- `x`: Horizontal position in dots from the left edge
- `y`: Vertical position in dots from the top edge
- `font`: Font name: "1" (8x12), "2" (12x20), "3" (16x24), "4" (24x32), "5" (32x48), or TrueType name
- `rotation`: 0 (0 deg), 90, 180, or 270
- `x-mul`: Horizontal enlargement (1-10)
- `y-mul`: Vertical enlargement (1-10)
- `data`: The text string to print (in double quotes)

Example:

```text
TEXT 50,30,"4",0,1,1,"Hello World"
```

Print "Hello World" at position 50,30 using font 4

## BOX — Rectangle / Box

Draws a rectangle (box) from the top-left corner (x1,y1) to the bottom-right corner (x2,y2) with the specified line thickness. An optional radius parameter rounds the corners.

- Category: graphics
- Syntax: `BOX x1,y1,x2,y2,thickness[,radius]`
- Preview supported: yes
- Canonical HTML: https://rfid.me/reference/tspl/box/

When to use: For drawing borders, boxes, table cells, and rectangular frames on your label.

Parameters:

- `x1`: Top-left X coordinate in dots
- `y1`: Top-left Y coordinate in dots
- `x2`: Bottom-right X coordinate in dots
- `y2`: Bottom-right Y coordinate in dots
- `thickness`: Line thickness in dots
- `radius`: Corner radius in dots (optional, default 0)

Example:

```text
BOX 20,20,380,260,2
```

Draw a rectangle from (20,20) to (380,260) with 2-dot lines

## BAR — Filled Bar

Draws a filled rectangular bar (solid black) at the specified position with the given width and height. Use this for solid divider lines, section fills, or thick separators.

- Category: graphics
- Syntax: `BAR x,y,width,height`
- Preview supported: yes
- Canonical HTML: https://rfid.me/reference/tspl/bar/

When to use: For solid lines, dividers, fills, and thick bars. A thin BAR (height=2) makes a clean divider line.

Parameters:

- `x`: Left edge X coordinate in dots
- `y`: Top edge Y coordinate in dots
- `width`: Width of the bar in dots
- `height`: Height of the bar in dots

Example:

```text
BAR 50,100,300,2
```

Draw a thin horizontal divider line at position (50,100)

## REVERSE — Reverse Block

Inverts the specified rectangular area on the label — black becomes white and white becomes black. Use it over text to create white-on-black reversed text blocks.

- Category: graphics
- Syntax: `REVERSE x,y,width,height`
- Preview supported: yes
- Canonical HTML: https://rfid.me/reference/tspl/reverse/

When to use: When you want white text on a black background — draw the text first, then use REVERSE over the same area.

Parameters:

- `x`: Left edge X coordinate in dots
- `y`: Top edge Y coordinate in dots
- `width`: Width of the reversed area in dots
- `height`: Height of the reversed area in dots

Example:

```text
BAR 40,20,320,40
TEXT 50,25,"4",0,1,1,"CAUTION"
REVERSE 40,20,320,40
```

Create white-on-black "CAUTION" text

## ERASE — Erase Area

Erases (clears to white) the specified rectangular area in the image buffer. Anything previously drawn in that area is removed. Per TSPL2 PG §ERASE (p43); the PG's canonical example draws BAR 100,100,300,300 then ERASE 150,150,200,200 to carve a hole out of the centre — document order matters, since ERASE paints over earlier draw commands.

- Category: graphics
- Syntax: `ERASE x,y,width,height`
- Preview supported: yes
- Canonical HTML: https://rfid.me/reference/tspl/erase/

When to use: When you need to clear a specific region of the label without clearing the entire buffer — carving holes, masking, or selective inverse of BAR. CLS clears the whole buffer; use ERASE for surgical strikes.

Parameters:

- `x`: Left edge X coordinate of the region in dots (TSPL2 PG: X_start)
- `y`: Top edge Y coordinate of the region in dots (TSPL2 PG: Y_start)
- `width`: Region width in the x-axis direction in dots (TSPL2 PG: X_width)
- `height`: Region height in the y-axis direction in dots (TSPL2 PG: Y_height)

Example:

```text
BAR 100,100,300,300
ERASE 150,150,200,200
```

Draw a 300x300 black bar at (100,100) then carve a 200x200 white hole out of its centre (TSPL2 PG §ERASE example)

## DIAGONAL — Diagonal Line

Draws a straight line from (x1,y1) to (x2,y2) with the given stroke thickness. Useful for crosses, voided-label diagonals, and quick separator strokes.

- Category: graphics
- Syntax: `DIAGONAL x1,y1,x2,y2,thickness`
- Preview supported: yes
- Canonical HTML: https://rfid.me/reference/tspl/diagonal/

When to use: When you need a single straight line at an arbitrary angle — a horizontal or vertical line is simpler with BAR.

Parameters:

- `x1`: Start-point X coordinate in dots
- `y1`: Start-point Y coordinate in dots
- `x2`: End-point X coordinate in dots
- `y2`: End-point Y coordinate in dots
- `thickness`: Stroke thickness in dots

Example:

```text
DIAGONAL 50,50,300,200,3
```

Draw a 3-dot-thick line from (50,50) to (300,200)

## BLOCK — Text Block (auto-wrap)

Draws a multi-line text block with automatic word-wrap inside a width × height bounding box. Like TEXT but words break at whitespace once they would exceed `width`, and the engine clips at `height` once `floor(height / fontHeight)` lines have been laid out. BLOCK is a TSPL2 firmware addendum (TX/TE/MH-series) — not in the 2009 PG.

- Category: graphics
- Syntax: `BLOCK x,y,width,height,"font",rotation,x-mul,y-mul,"data"`
- Preview supported: yes
- Canonical HTML: https://rfid.me/reference/tspl/block/

When to use: When you have variable-length text (description fields, multi-line addresses, product details) that needs to fit a fixed area without manual line-splitting. For single-line text use TEXT; for filled bars use BAR.

Parameters:

- `x`: Top-left X coordinate of the bounding box in dots
- `y`: Top-left Y coordinate of the bounding box in dots
- `width`: Width of the wrap region in dots — words wrap when they would exceed this
- `height`: Height of the wrap region in dots — clipped after floor(height/fontHeight) lines
- `font`: Font identifier in double quotes (same set TEXT accepts: "0"–"8", "ROMAN.TTF", etc.)
- `rotation`: 0, 90, 180, or 270 degrees
- `x-mul`: Horizontal magnification (1–10)
- `y-mul`: Vertical magnification (1–10)
- `data`: The text to render in double quotes; spaces are wrap points

Example:

```text
BLOCK 50,50,300,120,"3",0,1,1,"Long description that wraps automatically"
```

A 300×120 dot text block at (50,50), font "3", auto-wrapping the description

## CIRCLE — Circle

Draws a circle. (x,y) anchors the upper-left corner of the bounding box — not the centre — so the rendered centre lands at (x + diameter/2, y + diameter/2). Per TSPL2 PG §CIRCLE (p41).

- Category: graphics
- Syntax: `CIRCLE x,y,diameter,thickness`
- Preview supported: yes
- Canonical HTML: https://rfid.me/reference/tspl/circle/

When to use: When you need a round outline on the label — logos, status dots, registration marks. For filled circles, set thickness ≥ radius; the renderer fills the shape.

Parameters:

- `x`: Upper-left X coordinate of the bounding box in dots (NOT the centre)
- `y`: Upper-left Y coordinate of the bounding box in dots (NOT the centre)
- `diameter`: Diameter of the circle in dots
- `thickness`: Stroke thickness in dots; when ≥ radius the circle fills

Example:

```text
CIRCLE 250,20,100,1
```

Draw a 100-dot-diameter circle anchored at (250,20) with a 1-dot outline (PG example)

## ELLIPSE — Ellipse

Draws an ellipse inside a width × height bounding box. Like CIRCLE, (x,y) anchors the upper-left corner of the bounding box — not the centre — so the rendered centre lands at (x + width/2, y + height/2). ELLIPSE is a TSC firmware addendum (TX/TE/MH-series) — not in the 2009 TSPL2 PG.

- Category: graphics
- Syntax: `ELLIPSE x,y,width,height,thickness`
- Preview supported: yes
- Canonical HTML: https://rfid.me/reference/tspl/ellipse/

When to use: When you need an oval outline — chamfered seals, status indicators, decorative borders. For a true circle use CIRCLE (single diameter); ELLIPSE distinguishes horizontal and vertical radii.

Parameters:

- `x`: Upper-left X coordinate of the bounding box in dots (NOT the centre)
- `y`: Upper-left Y coordinate of the bounding box in dots (NOT the centre)
- `width`: Width of the bounding box in dots
- `height`: Height of the bounding box in dots
- `thickness`: Stroke thickness in dots

Example:

```text
ELLIPSE 100,100,200,150,3
```

Draw a 200×150 ellipse anchored at (100,100) with a 3-dot outline

## BARCODE — 1D Barcode

Draws a 1D barcode at the specified position. The "type" string selects the symbology — 30 values are valid per TSPL2 PG §BARCODE, covering Code 128, Code 39, EAN/UPC families, CODABAR, ITF, MSI, Plessey, and US/Chinese postal codes. The engine validates the type at parse time and emits a "did you mean" diagnostic on unknown values.

- Category: barcode
- Syntax: `BARCODE x,y,"type",height,readable,rotation,narrow,wide,"data"`
- Preview supported: yes
- Canonical HTML: https://rfid.me/reference/tspl/barcode/

When to use: When you need any 1D barcode — shipping labels, product IDs, inventory tracking. Pick the symbology with the "type" parameter; for 2D codes use QRCODE, DMATRIX, PDF417, AZTEC, etc.

Parameters:

- `x`: Horizontal position in dots
- `y`: Vertical position in dots
- `type`: Barcode symbology. One of 30 values per TSPL2 PG §BARCODE p33–37. Values: `"128"` (Code 128 (auto-subset)), `"128M"` (Code 128 manual subset selection), `"EAN128"` (GS1-128 (EAN-128) with FNC1), `"25"` (Interleaved 2 of 5 (I2of5)), `"25C"` (Interleaved 2 of 5 with mod-10 checksum), `"39"` (Code 39 (standard)), `"39C"` (Code 39 with mod-43 checksum), `"39S"` (Code 39 full ASCII), `"93"` (Code 93), `"EAN13"` (EAN-13), `"EAN13+2"` (EAN-13 with 2-digit add-on), `"EAN13+5"` (EAN-13 with 5-digit add-on), `"EAN8"` (EAN-8), `"EAN8+2"` (EAN-8 with 2-digit add-on), `"EAN8+5"` (EAN-8 with 5-digit add-on), `"CODA"` (Codabar), `"POST"` (USPS Postnet), `"UPCA"` (UPC-A), `"UPCA+2"` (UPC-A with 2-digit add-on), `"UPCA+5"` (UPC-A with 5-digit add-on), `"UPCE"` (UPC-E), `"UPCE+2"` (UPC-E with 2-digit add-on), `"UPCE+5"` (UPC-E with 5-digit add-on), `"CPOST"` (China Post 25), `"MSI"` (MSI Plessey), `"MSIC"` (MSI Plessey with mod-10 check digit), `"PLESSEY"` (Plessey (UK)), `"ITF14"` (ITF-14 (case/carton code)), `"EAN14"` (EAN-14 (DUN-14)), `"11"` (Code 11).
- `height`: Barcode height in dots
- `readable`: Human-readable text rendering mode Values: `0` (No human-readable text), `1` (Text below the barcode), `2` (Text above the barcode), `3` (Text both above and below).
- `rotation`: Rotation in degrees Values: `0` (No rotation (left to right)), `90` (90° clockwise), `180` (180° (upside down)), `270` (270° clockwise (90° counter-clockwise)).
- `narrow`: Narrow bar width in dots
- `wide`: Wide bar width in dots
- `data`: The data to encode (in double quotes)

Example:

```text
BARCODE 50,200,"128",80,1,0,2,4,"ABC-12345"
```

Code 128 barcode with human-readable text below

## QRCODE — QR Code

Draws a QR code at the specified position. You control the error correction level, cell size, encoding mode, and rotation. QR codes can store URLs, text, and other data.

- Category: barcode
- Syntax: `QRCODE x,y,ECC,cell,mode,rotation,"data"`
- Preview supported: yes
- Canonical HTML: https://rfid.me/reference/tspl/qrcode/

When to use: When you need a 2D barcode that can be scanned with a smartphone — URLs, asset IDs, or compact data encoding.

Parameters:

- `x`: Horizontal position in dots
- `y`: Vertical position in dots
- `ECC`: Error-correction level — higher recovers more of the symbol if damaged. Values: `L` (~7% recovery), `M` (~15% recovery (typical default)), `Q` (~25% recovery), `H` (~30% recovery).
- `cell`: Cell size in dots (1–10)
- `mode`: Encoding mode Values: `A` (Automatic — encoder picks numeric / alphanumeric / byte / kanji), `M` (Manual mode selection (legacy firmware)).
- `rotation`: Rotation in degrees Values: `0` (No rotation), `90` (90° clockwise), `180` (180° (upside down)), `270` (270° clockwise).
- `data`: The data to encode (in double quotes)

Example:

```text
QRCODE 50,50,M,5,A,0,"https://rfid.me"
```

QR code linking to rfid.me

## DMATRIX — Data Matrix

Draws a Data Matrix ECC 200 symbol — the compact square 2D barcode used for pharmaceutical labelling, automotive parts marking, and unit identification. (x,y) anchors the upper-left of the bounding rectangle; width × height define the maximum area the symbol may occupy. Real DataMatrix encoding is performed via `@rfid-me/epc-parser`. Per TSPL2 PG §DMATRIX (p47–48).

- Category: barcode
- Syntax: `DMATRIX x,y,width,height,[xm,row,col,]"data"`
- Preview supported: yes
- Canonical HTML: https://rfid.me/reference/tspl/dmatrix/

When to use: When you need a compact 2D barcode for small labels or high-density data — pharma serialisation (GS1 with FNC1 via `~1`), part marking, unit identification. For larger 2D codes use QRCODE; for 1D barcodes use BARCODE.

Parameters:

- `x`: Upper-left X coordinate of the bounding rectangle in dots
- `y`: Upper-left Y coordinate of the bounding rectangle in dots
- `width`: Maximum width of the bounding rectangle in dots
- `height`: Maximum height of the bounding rectangle in dots
- `xm`: Optional module size in dots (1–9)
- `row`: Optional forced row count (must be a legal ECC 200 row size — 10, 12, 14, … 144)
- `col`: Optional forced column count (must be a legal ECC 200 column size — 10, 12, 14, … 144)
- `data`: Data to encode in double quotes. Use `~1` for FNC1 (GS1 application identifiers), `~d###` for ASCII decimal escape sequences

Example:

```text
DMATRIX 100,100,400,400,"DMATRIX EXAMPLE 1"
```

A Data Matrix encoding the string "DMATRIX EXAMPLE 1" within a 400×400 dot bounding rectangle (PG example)

## DENSITY — Print Density

Sets the print darkness (density). Higher values produce darker output. The range is 0-15. Start at 8 and adjust up or down based on scan results and visual quality.

- Category: config
- Syntax: `DENSITY n`
- Preview supported: yes
- Canonical HTML: https://rfid.me/reference/tspl/density/

When to use: When you need to adjust print darkness — barcode scanning issues often stem from incorrect density settings.

Parameters:

- `n`: Density level 0 (lightest) to 15 (darkest)

Example:

```text
DENSITY 8
```

Set print density to medium (8)

## SPEED — Print Speed

Sets the print speed in inches per second. Higher speeds are faster but may reduce print quality. Available speeds depend on your printer model.

- Category: config
- Syntax: `SPEED n`
- Preview supported: yes
- Canonical HTML: https://rfid.me/reference/tspl/speed/

When to use: When you need to balance speed and quality — slow down for barcodes that need to scan perfectly, speed up for text-only labels.

Parameters:

- `n`: Speed in inches per second (1-12, model-dependent)

Example:

```text
SPEED 4
```

Set print speed to 4 inches per second

## CODEPAGE — Character Code Page

Selects the character encoding for TEXT data (TSPL2 PG §CODEPAGE p18–19). Different code pages support different glyph sets — critical for international characters. Default at power-on is `437` (US OEM). The PG enumerates four families: 7-bit national variants (USA / BRI / GER / FRE / DAN / ITA / SPA / SWE / SWI), 8-bit DOS codepages (437 / 850 / 852 / 860 / 863 / 865 / 857), Windows codepages (1250 / 1252 / 1253 / 1254 / WPC1251 / WPC1255 / WPC1257 / 866), plus per-model UTF-8 / CJK additions in the model-specific appendix. Engine-recognised but doesn't currently apply byte→glyph mapping in TEXT (always passes through UTF-8/ASCII). Follow-up tracked for the mapping work.

- Category: config
- Syntax: `CODEPAGE n`
- Preview supported: no
- Canonical HTML: https://rfid.me/reference/tspl/codepage/

When to use: Once per label-script when printing non-ASCII characters whose mapping depends on encoding (e.g. accented Latin, Cyrillic, Greek, Turkish). Pair with COUNTRY for region-appropriate date/keyboard handling.

Parameters:

- `n`: Code page identifier (case-insensitive). Values: `USA` (7-bit USA), `BRI` (7-bit British), `GER` (7-bit German), `FRE` (7-bit French), `DAN` (7-bit Danish), `ITA` (7-bit Italian), `SPA` (7-bit Spanish), `SWE` (7-bit Swedish), `SWI` (7-bit Swiss), `437` (8-bit USA OEM (default at power-on)), `850` (8-bit Multilingual Latin-1), `852` (8-bit Slavic / Latin-2), `857` (8-bit Turkish), `860` (8-bit Portuguese), `863` (8-bit Canadian-French), `865` (8-bit Nordic), `866` (8-bit Cyrillic II), `1250` (Windows Central Europe), `1252` (Windows Latin I (Western Europe)), `1253` (Windows Greek), `1254` (Windows Turkish), `WPC1251` (Windows Cyrillic), `WPC1255` (Windows Hebrew), `WPC1257` (Windows Baltic).

Example:

```text
CODEPAGE 1252
SIZE 100 mm, 50 mm
CLS
TEXT 50,30,"3",0,1,1,"Café Müller"
PRINT 1
```

Use Windows-1252 for Western-European characters

## SET — Printer Configuration Dispatcher

Generic printer-configuration dispatcher (TSPL2 PG §SET p132–148). The first word after SET picks the setting being changed. Engine-recognised sub-actions cover the full PG-documented set except GAP, which requires lexer-mode disambiguation (tracked separately). All SET settings are persistent across power cycles unless the sub-page says otherwise (RIBBON is non-persistent). Engine-recognised but not rendered — labels with SET configure the printer hardware rather than producing label content.

- Category: config
- Syntax: `SET <sub-action> <args>`
- Preview supported: no
- Canonical HTML: https://rfid.me/reference/tspl/set/

When to use: For advanced printer configuration — cutter control, tear-off settings, peel-off mode, ribbon/head sensor mode, counters, front-panel key remap, network/host config. Best placed once at the top of a label setup script; settings persist until changed.

Parameters:

- `sub-action`: The printer setting to configure (case-insensitive). Values: `PEEL` (Peel-off mode (ON/OFF)), `TEAR` (Tear-off mode (ON/OFF)), `CUTTER` (Auto-cutter mode (OFF/BATCH/<pieces>)), `HEAD` (Head-open sensor mode (ON/OFF)), `RIBBON` (Ribbon-detect mode (ON/OFF) — non-persistent), `COUNTER` (Initialise/step a counter variable (@n step)), `PARTIAL_CUTTER` (Partial-cut mode (OFF/BATCH/<pieces>)), `BACK` (Back-feed toggle (ON/OFF)), `KEY1` (Front-panel KEY1 remap (OFF/MENU/PAUSE/FEED/…)), `KEY2` (Front-panel KEY2 remap (OFF/MENU/PAUSE/FEED/…)), `REWIND` (External rewinder toggle (ON/OFF)), `PRINTKEY` (Print-key behaviour (OFF/ON/AUTO/<n>)), `STRIPER` (Alias of TEAR (PG p143–144)).
- `args`: Sub-action-specific arguments — see the individual SET <sub-action> entries

Example:

```text
SET CUTTER ON
SET PEEL OFF
SET TEAR ON
```

Enable the automatic cutter, disable peel-off mode, enable tear-off

## SET PEEL — Peel-off Mode

Toggles the printer's peel-off mode (TSPL2 PG §SET p142). When ON, the printer waits for the operator to remove each label from the liner before printing the next; when OFF, labels print continuously. Persistent across power cycles.

- Category: config
- Syntax: `SET PEEL ON \| SET PEEL OFF`
- Preview supported: no
- Canonical HTML: https://rfid.me/reference/tspl/set-peel/

When to use: Once per peel-equipped printer to match the deployment's label-presentation flow. Typically paired with a peel-sensor that gates the next print until the previous label is taken.

Parameters:

- `state`: Peel-off mode (case-insensitive). Values: `ON` (Enable peel-off — pause between labels until taken), `OFF` (Disable peel-off — print continuously).

Example:

```text
SET PEEL ON
```

Enable peel-off mode

## SET TEAR — Tear-off Mode

Toggles the printer's tear-off behaviour (TSPL2 PG §SET p143–144; alias STRIPER on some models). When ON, the printer advances each label past the tear bar after printing so the operator can tear it off cleanly; when OFF, the label stops at the print head. Persistent across power cycles.

- Category: config
- Syntax: `SET TEAR ON \| SET TEAR OFF`
- Preview supported: no
- Canonical HTML: https://rfid.me/reference/tspl/set-tear/

When to use: For tear-bar-equipped printers when the deployment requires the print head to advance the label for clean tearing.

Parameters:

- `state`: Tear-off mode (case-insensitive). Values: `ON` (Enable tear-off — advance past tear bar after each label), `OFF` (Disable tear-off — stop at the print head).

Example:

```text
SET TEAR ON
```

Enable tear-off advance after each label

## SET CUTTER — Auto-Cutter Mode

Configures the optional auto-cutter (TSPL2 PG §SET p133). OFF disables the cutter; BATCH cuts once at the end of a print batch; a numeric argument cuts every N labels. Persistent across power cycles. Only effective on cutter-equipped printers — sending this to a non-cutter model is a recognised no-op.

- Category: config
- Syntax: `SET CUTTER OFF \| SET CUTTER BATCH \| SET CUTTER <pieces>`
- Preview supported: no
- Canonical HTML: https://rfid.me/reference/tspl/set-cutter/

When to use: Once at the top of a label-batch script on cutter-equipped printers. Pair with PRINT for predictable cut points.

Parameters:

- `mode`: Cutter mode (case-insensitive; OFF/BATCH/<pieces>). Values: `OFF` (Disable the auto-cutter), `BATCH` (Cut once at the end of the batch), `<pieces>` (Numeric: cut every N labels (e.g. SET CUTTER 1 cuts every label)).

Example:

```text
SET CUTTER 1
PRINT 5
```

Cut after every label across a 5-label batch

## SET HEAD — Head-Open Sensor Mode

Toggles the head-open sensor (TSPL2 PG §SET p147). When ON (the safe default), the printer halts printing if the print head is opened mid-job; when OFF, the sensor is ignored. Persistent across power cycles. **Do not disable in production** — head-open during printing can damage the print head or smear ink/ribbon.

- Category: config
- Syntax: `SET HEAD ON \| SET HEAD OFF`
- Preview supported: no
- Canonical HTML: https://rfid.me/reference/tspl/set-head/

When to use: Leave ON for production deployments. Only consider OFF during bench testing of head-sensor wiring, and re-enable before shipping.

Parameters:

- `state`: Head-open sensor (case-insensitive). Values: `ON` (Enable head-open sensor (safe default)), `OFF` (Disable head-open sensor (bench testing only)).

Example:

```text
SET HEAD ON
```

Enable the head-open sensor (safe default)

## SET RIBBON — Ribbon-Detect Mode

Toggles the ribbon-detect sensor (TSPL2 PG §SET p148). When ON, the printer halts if it doesn't detect a thermal-transfer ribbon (i.e. assumes thermal-transfer mode); when OFF, the printer assumes direct-thermal media and ignores the ribbon sensor. **Non-persistent — reverts on power cycle.** This is the only SET sub-action whose value isn't kept across reboots.

- Category: config
- Syntax: `SET RIBBON ON \| SET RIBBON OFF`
- Preview supported: no
- Canonical HTML: https://rfid.me/reference/tspl/set-ribbon/

When to use: Once per power cycle to match the loaded media. Direct-thermal media → OFF; thermal-transfer with ribbon → ON. Re-issue on every boot.

Parameters:

- `state`: Ribbon-detect (case-insensitive). Non-persistent. Values: `ON` (Thermal-transfer mode — require ribbon present), `OFF` (Direct-thermal mode — ignore ribbon sensor).

Example:

```text
SET RIBBON OFF
```

Direct-thermal mode (no ribbon required)

## SET COUNTER — Counter Variable

Initialises or increments a printer-side counter variable (TSPL2 PG §SET COUNTER p132). `@n` is the counter index (typically `@0`–`@9`); `step` is the increment applied between labels in a print batch. Counter values are referenced from TEXT/BARCODE payloads via the `@n` placeholder. Useful for serialised label batches without round-tripping to the host for each value. Engine recognises the command but doesn't currently model the `@n` placeholder substitution in TEXT/BARCODE — placeholder rendering is a separate feature.

- Category: config
- Syntax: `SET COUNTER @n step`
- Preview supported: no
- Canonical HTML: https://rfid.me/reference/tspl/set-counter/

When to use: For serialised batches (e.g. consecutive part numbers) when the host wants to send one label template and let the printer increment internally.

Parameters:

- `@n`: Counter variable name (e.g. `@0`, `@1`).
- `step`: Increment applied between labels (integer; negative permitted to count down).

Example:

```text
SET COUNTER @0 1
SIZE 100 mm, 50 mm
CLS
TEXT 50,30,"3",0,1,1,"Serial: @0"
PRINT 10
```

Initialise counter @0 with step 1, then print 10 labels with auto-incrementing serial numbers

## SET PARTIAL_CUTTER — Partial-Cut Mode

Configures the partial-cutter accessory (TSPL2 PG §SET PARTIAL_CUTTER p134). Sibling of `SET CUTTER` — partial cut leaves a small tab so the next label hangs from the previous, useful for catalog/peel-off workflows. OFF disables the partial cutter; BATCH cuts once at the end of a print batch; a numeric argument cuts every N labels. Persistent across power cycles. Only effective on partial-cutter-equipped hardware — sending this to a non-cutter model is a recognised no-op.

- Category: config
- Syntax: `SET PARTIAL_CUTTER OFF \| SET PARTIAL_CUTTER BATCH \| SET PARTIAL_CUTTER <pieces>`
- Preview supported: no
- Canonical HTML: https://rfid.me/reference/tspl/set-partial-cutter/

When to use: On printers with a partial-cutter accessory when the workflow needs labels to hang together for downstream picking/peeling.

Parameters:

- `mode`: Partial-cut mode (case-insensitive; OFF/BATCH/<pieces>). Values: `OFF` (Disable the partial cutter), `BATCH` (Partial-cut once at the end of the batch), `<pieces>` (Numeric: partial-cut every N labels).

Example:

```text
SET PARTIAL_CUTTER 1
PRINT 5
```

Partial-cut after every label across a 5-label batch

## SET BACK — Back-Feed Toggle

Toggles automatic back-feed after each print (TSPL2 PG §SET BACK p135). When ON, the printer retracts to its print-start position after each label — useful for peel-off and tear-off workflows where the label needs to be repositioned before the next print. Persistent across power cycles. Distinct from the top-level `BACKFEED n` command, which is a one-shot retract by N dots.

- Category: config
- Syntax: `SET BACK ON \| SET BACK OFF`
- Preview supported: no
- Canonical HTML: https://rfid.me/reference/tspl/set-back/

When to use: On peel-off or tear-off deployments when each label needs to retract to a consistent start position automatically.

Parameters:

- `state`: Back-feed toggle (case-insensitive). Values: `ON` (Enable automatic back-feed after each print), `OFF` (Disable automatic back-feed).

Example:

```text
SET BACK ON
```

Enable automatic back-feed after each printed label

## SET KEY1 — Front-Panel KEY1 Remap

Remaps the printer's front-panel KEY1 to a chosen action (TSPL2 PG §SET KEY1 p136–137). Useful for tuning printer behaviour to a specific deployment — e.g. mapping KEY1 to PAUSE for an interactive workflow, or to CALIBRATION for a maintenance role. Persistent across power cycles.

- Category: config
- Syntax: `SET KEY1 <action>`
- Preview supported: no
- Canonical HTML: https://rfid.me/reference/tspl/set-key1/

When to use: Once per printer at provisioning — adjust the front-panel UX to match the deployment.

Parameters:

- `action`: Action enum (case-insensitive). Available actions per PG p136–137. Values: `OFF` (KEY1 does nothing), `MENU` (Open the front-panel menu), `PAUSE` (Pause / resume the current print job), `FEED` (Feed one label), `CALIBRATION` (Run sensor calibration), `BATCH` (Reprint the last batch).

Example:

```text
SET KEY1 PAUSE
```

Map the front-panel KEY1 to pause/resume the current job

## SET KEY2 — Front-Panel KEY2 Remap

Remaps the printer's front-panel KEY2 to a chosen action (TSPL2 PG §SET KEY2 p137–138). Identical action enum to `SET KEY1`. Persistent across power cycles. Useful for printers with a two-key front panel where each key gets a distinct workflow role (e.g. KEY1 = PAUSE, KEY2 = FEED).

- Category: config
- Syntax: `SET KEY2 <action>`
- Preview supported: no
- Canonical HTML: https://rfid.me/reference/tspl/set-key2/

When to use: Together with `SET KEY1` at provisioning to set up the dual-key front-panel UX.

Parameters:

- `action`: Action enum (case-insensitive). Same actions as SET KEY1. Values: `OFF` (KEY2 does nothing), `MENU` (Open the front-panel menu), `PAUSE` (Pause / resume the current print job), `FEED` (Feed one label), `CALIBRATION` (Run sensor calibration), `BATCH` (Reprint the last batch).

Example:

```text
SET KEY1 PAUSE
SET KEY2 FEED
```

Set up a two-key panel: KEY1 = pause/resume, KEY2 = manual feed

## SET REWIND — External-Rewinder Toggle

Toggles external-rewinder support (TSPL2 PG §SET REWIND p139). When ON, the printer drives an attached external-rewinder accessory; when OFF, no rewinder signalling is generated. Persistent across power cycles. Only effective on rewinder-equipped deployments — sending this to a printer without the accessory is a recognised no-op.

- Category: config
- Syntax: `SET REWIND ON \| SET REWIND OFF`
- Preview supported: no
- Canonical HTML: https://rfid.me/reference/tspl/set-rewind/

When to use: Once per printer at provisioning when an external rewinder is fitted, to enable the rewinder drive signal.

Parameters:

- `state`: External-rewinder toggle (case-insensitive). Values: `ON` (Enable external-rewinder drive), `OFF` (Disable external-rewinder drive).

Example:

```text
SET REWIND ON
```

Enable the external-rewinder accessory

## SET PRINTKEY — Print-Key Behaviour

Configures the front-panel print-key behaviour (TSPL2 PG §SET PRINTKEY p140). OFF disables the print key; ON makes a single press print one label; AUTO triggers auto-repeat printing while the key is held; a numeric value `<n>` prints N labels per press. Persistent across power cycles.

- Category: config
- Syntax: `SET PRINTKEY OFF \| SET PRINTKEY ON \| SET PRINTKEY AUTO \| SET PRINTKEY <n>`
- Preview supported: no
- Canonical HTML: https://rfid.me/reference/tspl/set-printkey/

When to use: When the operator workflow expects the front-panel print key to behave differently from the default single-shot — e.g. AUTO for a print-while-held demo mode, or numeric for fixed-count batches.

Parameters:

- `mode`: Print-key behaviour (case-insensitive, or numeric). Values: `OFF` (Disable the print key), `ON` (Single-shot — one press prints one label), `AUTO` (Auto-repeat while held), `<n>` (Numeric: print N labels per press).

Example:

```text
SET PRINTKEY AUTO
```

Make the print-key auto-repeat while held (useful for demos)

## SET STRIPER — Striper (alias of SET TEAR)

Alias of `SET TEAR` on some firmware revisions (TSPL2 PG §SET STRIPER p143–144). Same semantics, alternate keyword surfaced for models that ship with a "striper" label on the front panel. See `SET TEAR` for the canonical documentation — anything you can do with one, you can do with the other. Persistent across power cycles.

- Category: config
- Syntax: `SET STRIPER ON \| SET STRIPER OFF`
- Preview supported: no
- Canonical HTML: https://rfid.me/reference/tspl/set-striper/

When to use: Use `SET TEAR` for new code (clearer naming, matches the front-panel label on most printers). Use `SET STRIPER` only when matching legacy or model-specific label scripts.

Parameters:

- `state`: Striper / tear-off mode (case-insensitive). Values: `ON` (Enable striper / tear-off — advance past tear bar after each label), `OFF` (Disable — stop at the print head).

Example:

```text
SET STRIPER ON
```

Enable tear-off advance via the striper alias

## SHIFT — Vertical Label Shift

Shifts the entire imaged label vertically by `n` dots (positive or negative). Used to align with pre-printed stock, correct registration drift, or fine-tune the print position without re-issuing every coordinate. TSPL2 PG §SHIFT p15–16: range is ±203 dots on 200 DPI printers, ±300 on 300 DPI printers (max 1 inch absolute). A positive value moves the label further from the printing direction; negative moves it toward.

- Category: label
- Syntax: `SHIFT n`
- Preview supported: yes
- Canonical HTML: https://rfid.me/reference/tspl/shift/

When to use: When the printed image needs a small vertical nudge — typically after measuring registration on a test print and noticing the image is consistently a few dots off-target.

Parameters:

- `n`: Vertical shift in dots (negative or positive). Range ±203 for 200 DPI, ±300 for 300 DPI; max ±1 inch.

Example:

```text
SIZE 100 mm, 50 mm
SHIFT 12
CLS
TEXT 50,30,"3",0,1,1,"Shifted down by 12 dots"
PRINT 1
```

Shift the entire label image 12 dots further from the printing direction

## LIMITFEED — Calibration Feed Limit

Caps the distance the printer feeds while searching for the next label gap during calibration / HOME. TSPL2 PG §LIMITFEED p30. Prevents runaway feeds on mis-cut or misaligned stock. Default 10 inches at boot. Two forms: `LIMITFEED n` (inches, English system) or `LIMITFEED n mm` (metric — must have a space before `mm`). Resident in memory across the session. No visual rendering effect — runtime hardware behaviour.

- Category: config
- Syntax: `LIMITFEED n \| LIMITFEED n mm`
- Preview supported: no
- Canonical HTML: https://rfid.me/reference/tspl/limitfeed/

When to use: When working with unusual label stock where the auto-calibration could otherwise feed an excessive length searching for the next gap (e.g. die-cut stock with inconsistent gaps, or wide form-feed paper).

Parameters:

- `n`: Maximum sensor-detect length. Bare number = inches; followed by ` mm` (with leading space) = millimetres.

Example:

```text
LIMITFEED 6
HOME
SIZE 100 mm, 50 mm
CLS
TEXT 50,30,"3",0,1,1,"Calibrated"
PRINT 1
```

Cap calibration feed at 6 inches before running HOME

## COUNTRY — Country / Language Code

Selects the country / language code that orients the KP-200-series LCD keyboard and affects special-character mapping for built-in fonts. TSPL2 PG §COUNTRY p17. `n` is a 3-digit code: 001 USA, 002 Canadian-French, 003 Spanish (Latin America), 031 Dutch, 032 Belgian, 033 French, 034 Spanish (Spain), 036 Hungarian, 038 Yugoslavian, 039 Italian, 041 Switzerland, 042 Slovak, 044 United Kingdom, 045 Danish, 046 Swedish, 047 Norwegian, 048 Polish, 049 German, 055 Brazil, 061 English (International), 351 Portuguese, 358 Finnish. Engine accepts the code but doesn't currently apply locale-specific TEXT formatting — flagged as supported:false until the date-placeholder feature lands.

- Category: config
- Syntax: `COUNTRY n`
- Preview supported: no
- Canonical HTML: https://rfid.me/reference/tspl/country/

When to use: When deploying to a region whose keyboard layout / date format differs from the printer's default. Pair with the appropriate CODEPAGE for character-set coverage.

Parameters:

- `n`: 3-digit country code. Values: `001` (USA), `002` (Canadian-French), `003` (Spanish (Latin America)), `031` (Dutch), `032` (Belgian), `033` (French (France)), `034` (Spanish (Spain)), `036` (Hungarian), `038` (Yugoslavian), `039` (Italian), `041` (Switzerland), `042` (Slovak), `044` (United Kingdom), `045` (Danish), `046` (Swedish), `047` (Norwegian), `048` (Polish), `049` (German), `055` (Brazil), `061` (English (International)), `351` (Portuguese), `358` (Finnish).

Example:

```text
COUNTRY 044
CODEPAGE 1252
SIZE 100 mm, 50 mm
CLS
TEXT 50,30,"3",0,1,1,"UK locale"
PRINT 1
```

Configure UK locale and Windows-1252 codepage

## SOUND — Printer Beeper

Triggers the printer's beeper for a tone at the specified level and duration. TSPL2 PG §SOUND p28. `level` is the sound level / tone (0–9, 10 discrete steps), `interval` is the timing control (1–4095). Chain multiple SOUND lines to play a tune. No visual rendering effect — runtime hardware behaviour. Useful for signalling end-of-batch or alerting the operator.

- Category: control
- Syntax: `SOUND level, interval`
- Preview supported: no
- Canonical HTML: https://rfid.me/reference/tspl/sound/

When to use: To signal job completion (e.g. end of a long print batch) or to alert the operator (e.g. after `SET HEAD OFF` debugging). Place anywhere in the label script.

Parameters:

- `level`: Sound level / tone (0–9, 10 discrete steps).
- `interval`: Timing control (1–4095).

Example:

```text
SIZE 100 mm, 50 mm
CLS
TEXT 50,30,"3",0,1,1,"Beep done"
PRINT 1
SOUND 5, 200
SOUND 9, 100
```

Print a label then play a two-note end-of-batch beep

## DOWNLOAD — Download File

Begins downloading a file (program, font, or image) to the printer's internal flash memory. The data follows on subsequent lines until EOP.

- Category: config
- Syntax: `DOWNLOAD "filename"`
- Preview supported: no
- Canonical HTML: https://rfid.me/reference/tspl/download/

When to use: When storing label templates, custom fonts, or images in the printer's memory for later use.

Parameters:

- `filename`: Name of the file to store (in double quotes)

Example:

```text
DOWNLOAD "LOGO.BMP",1024,<binary data>
```

Download a bitmap image to the printer

## RFID — RFID Gen2 Operation

Dispatches an RFID Gen2 tag operation. The first word after RFID picks the action — READ pulls data out of a memory bank, WRITE encodes data into a bank, LOCK applies a Gen2 lock policy, KILL irreversibly disables the tag, and PERMALOCK irreversibly locks a bank. The bank selector (in quotes) is one of "EPC", "USER", "TID", or "RESERVED". This command only works on TSPL2 printers with an RFID head fitted (e.g. TSC TTP-247R, TTP-2410MT, MH-241).

- Category: rfid
- Syntax: `RFID <sub-action> "<bank>"[, <args...>]`
- Preview supported: yes
- Canonical HTML: https://rfid.me/reference/tspl/rfid/

When to use: Whenever you need to encode, read, or secure RFID tag memory as part of a label print job. Pair with normal print commands (TEXT, BARCODE) to print a human-readable tag alongside encoding.

Parameters:

- `sub-action`: The Gen2 operation to dispatch (case-insensitive). Values: `READ` (Read N bytes from a memory bank at a given offset), `WRITE` (Encode bytes into a memory bank at a given offset), `LOCK` (Apply a Gen2 access-policy lock to a memory bank), `KILL` (Irreversibly disable the tag (requires the kill password)), `PERMALOCK` (Irreversibly lock a memory bank (cannot be reversed)).
- `bank`: Quoted Gen2 memory bank (omit for KILL — which takes only a password). Values: `"EPC"` (Electronic Product Code bank), `"USER"` (User memory bank), `"TID"` (Tag Identifier bank (typically read-only)), `"RESERVED"` (Reserved bank (access/kill passwords)).
- `args`: Sub-action-specific arguments — offset/length for READ, offset/data for WRITE, password/policy for LOCK, password for KILL, password for PERMALOCK

Example:

```text
SIZE 100 mm, 50 mm
CLS
RFID WRITE "EPC", 0, "E2801160600002054E5F8B41"
TEXT 50,30,"3",0,1,1,"Encoded"
PRINT 1
```

Encode a 96-bit EPC into the tag's EPC bank, print a confirmation label

## RFID READ — RFID Read Bank

Reads `<length>` bytes from `<bank>` starting at byte `<offset>` (TSPL2 PG §RFID READ p113). Offset and length are byte counts, not word counts. The read result is returned to the host as a hex string over the back-channel and may be displayed on the printer LCD on firmware that supports it. Engine-recognised but no SVG output — RFID operations don't produce label content.

- Category: rfid
- Syntax: `RFID READ "<bank>", <offset>, <length>`
- Preview supported: no
- Canonical HTML: https://rfid.me/reference/tspl/rfid-read/

When to use: For host-driven inventory audits, read-back-after-write verification, or to pull TID data for tag-authentication workflows. Pair with the printer's back-channel reader on the host side.

Parameters:

- `bank`: Quoted Gen2 memory bank. Values: `"EPC"` (Electronic Product Code bank (typically 12 bytes for SGTIN-96)), `"USER"` (User memory bank (size varies by tag chip)), `"TID"` (Tag Identifier bank (read-only, factory-programmed)), `"RESERVED"` (Reserved bank (kill + access passwords, 8 bytes total)).
- `offset`: Byte offset within the bank (0-based).
- `length`: Number of bytes to read.

Example:

```text
RFID READ "EPC", 0, 12
```

Read the full 96-bit EPC (12 bytes from offset 0 of the EPC bank)

## RFID WRITE — RFID Write Bank

Encodes `<hex-data>` into `<bank>` starting at byte `<offset>` (TSPL2 PG §RFID WRITE p114). `<hex-data>` is a hex-character string — each pair of hex chars = 1 byte. EPC bank typically takes 24 hex chars for the 96-bit SGTIN-96 encoding. If `<data>` length doesn't match the bank's word boundary, the write is padded or truncated per the Gen2 spec. Note: the TID bank is factory-locked and not writable — the engine emits a warning when targeting it.

- Category: rfid
- Syntax: `RFID WRITE "<bank>", <offset>, "<hex-data>"`
- Preview supported: no
- Canonical HTML: https://rfid.me/reference/tspl/rfid-write/

When to use: The core "print-and-encode" command: write the EPC (or any other bank) at the moment of label print, so the printed barcode/text and the encoded chip stay in lockstep.

Parameters:

- `bank`: Quoted Gen2 memory bank (writable subset). Values: `"EPC"` (Electronic Product Code bank), `"USER"` (User memory bank), `"RESERVED"` (Reserved bank (kill + access passwords)).
- `offset`: Byte offset within the bank (0-based).
- `hex-data`: Quoted hex string. Each pair of hex chars = 1 byte (e.g. 24 chars = 12 bytes = 96-bit EPC).

Example:

```text
SIZE 100 mm, 50 mm
CLS
RFID WRITE "EPC", 0, "112233445566778899AABBCC"
TEXT 50,30,"3",0,1,1,"Encoded"
PRINT 1
```

Encode a 96-bit EPC into the EPC bank and print a confirmation label

## RFID LOCK — RFID Lock Bank

Applies a Gen2 access-policy lock to `<bank>` using the 32-bit access password (TSPL2 PG §RFID LOCK p116). `<password>` is 8 hex characters. `<policy>` is the Gen2 lock-action enum (0–3). Policy 3 is irreversible (use `RFID PERMALOCK` as the convenience wrapper). Note: the RESERVED bank exposes two named partitions on some firmware — `"KILL"` for the kill-password area and `"ACCESS"` for the access-password area.

- Category: rfid
- Syntax: `RFID LOCK "<bank>", "<password>", <policy>`
- Preview supported: no
- Canonical HTML: https://rfid.me/reference/tspl/rfid-lock/

When to use: After encoding the EPC (or other bank), to prevent unauthorised re-writes. Pair with `RFID WRITE`.

Parameters:

- `bank`: Quoted Gen2 memory bank or RESERVED partition. Values: `"EPC"` (Electronic Product Code bank), `"USER"` (User memory bank), `"TID"` (Tag Identifier bank (read-only on most tags)), `"RESERVED"` (Whole reserved bank), `"KILL"` (Kill-password partition of RESERVED), `"ACCESS"` (Access-password partition of RESERVED).
- `password`: Quoted 8-hex-character access password (32 bits).
- `policy`: Gen2 lock-action enum. Values: `0` (Unlocked — writable without password), `1` (Locked — writable only with access password), `2` (Permanently unlocked — cannot be locked again), `3` (Permanently locked — cannot be unlocked (use RFID PERMALOCK as convenience wrapper)).

Example:

```text
RFID LOCK "EPC", "12345678", 1
```

Lock the EPC bank so subsequent writes require the access password "12345678"

## RFID KILL — RFID Kill (Permanent Disable)

⚠️ **Permanently and irreversibly disables the tag — cannot be undone.** Issues the Gen2 Kill command using the tag's 32-bit kill password (TSPL2 PG §RFID KILL p118). `<kill-password>` is 8 hex characters. A non-zero kill password is required by the Gen2 spec — the tag will reject KILL if its kill-password is all-zero (the engine surfaces this as a diagnostic). The kill password must have been previously written into the RESERVED bank (bytes 0–3) and is typically locked at the same time. Once successfully killed, the tag is permanently silent — no further reads or writes are possible. Used at end-of-life destruction stations for items leaving the supply chain.

- Category: rfid
- Syntax: `RFID KILL "<kill-password>"`
- Preview supported: no
- Canonical HTML: https://rfid.me/reference/tspl/rfid-kill/

When to use: Destruction-station workflows only — at end-of-life when the tag must never be readable again. Treat the kill password as a credential: do not commit label sources containing it to public repositories.

Parameters:

- `kill-password`: Quoted 8-hex-character kill password (32 bits). Must be non-zero per Gen2 spec — a tag with a zero kill-password rejects KILL.

Example:

```text
RFID KILL "DEADBEEF"
```

⚠️ Irreversibly destroy the tag using its 32-bit kill password

## RFID PERMALOCK — RFID Permanent Lock

⚠️ **Irreversibly locks `<bank>` — the bank cannot be unlocked again.** Convenience wrapper for `RFID LOCK "<bank>", "<password>", 3` (Gen2 policy 3 = permanently-locked). `<password>` is the 8-hex-character (32-bit) access password. After successful execution, the bank's lock state cannot be changed — subsequent `RFID LOCK` or `RFID PERMALOCK` calls against that bank will fail.

- Category: rfid
- Syntax: `RFID PERMALOCK "<bank>", "<password>"`
- Preview supported: no
- Canonical HTML: https://rfid.me/reference/tspl/rfid-permalock/

When to use: Supply-chain workflows where the EPC must never be rewritten after the tag leaves the encoding station. Use sparingly — once permalocked, you cannot recover the bank for re-use.

Parameters:

- `bank`: Quoted Gen2 memory bank or RESERVED partition. Values: `"EPC"` (Electronic Product Code bank), `"USER"` (User memory bank), `"TID"` (Tag Identifier bank), `"RESERVED"` (Whole reserved bank), `"KILL"` (Kill-password partition of RESERVED), `"ACCESS"` (Access-password partition of RESERVED).
- `password`: Quoted 8-hex-character access password (32 bits).

Example:

```text
RFID WRITE "EPC", 0, "E2801160600002054E5F8B41"
RFID PERMALOCK "EPC", "12345678"
```

⚠️ Encode a 96-bit EPC then irreversibly lock the EPC bank

## BT — Bluetooth Configuration Dispatcher

Generic Bluetooth configuration dispatcher. The first word after BT picks the sub-action — NAME sets the device name visible to pairing hosts, PIN sets the legacy-pairing PIN. Not in the 2009 TSPL2 PG: Bluetooth is an optional module on later TSC models (TX/TE/MH-series and Alpha-series with optional BT) and the commands are documented in per-model BT setup addenda. Engine-recognised but not rendered — labels with BT configure the printer hardware rather than producing label content.

- Category: config
- Syntax: `BT <sub-action> <args>`
- Preview supported: no
- Canonical HTML: https://rfid.me/reference/tspl/bt/

When to use: When configuring a BT-equipped TSC printer's Bluetooth radio in-band as part of a label setup script. Refer to the target model's BT setup guide for the supported sub-keyword set on that firmware revision.

Parameters:

- `sub-action`: The Bluetooth setting to configure (case-insensitive). Values: `NAME` (Bluetooth friendly-name advertised over GAP), `PIN` (Bluetooth legacy-pairing PIN (BT 2.1+EDR; no-op on SSP-only firmware)).
- `args`: Sub-action-specific arguments — see the BT NAME and BT PIN entries

Example:

```text
BT NAME "TSC-Printer-01"
BT PIN "1234"
```

Set the Bluetooth device name and pairing PIN

## BT NAME — Bluetooth Device Name

Sets the Bluetooth friendly-name the printer advertises over GAP, visible to pairing hosts during device discovery. Not in the 2009 TSPL2 PG — refer to the target model's BT setup addendum for the supported character set and maximum length on that firmware.

- Category: config
- Syntax: `BT NAME "<device-name>"`
- Preview supported: no
- Canonical HTML: https://rfid.me/reference/tspl/bt-name/

When to use: When provisioning a BT-equipped TSC printer and you want a meaningful name in the host's Bluetooth picker rather than the factory default.

Parameters:

- `device-name`: Quoted friendly-name to advertise. Verify max-length and allowed characters against the model's addendum.

Example:

```text
BT NAME "TSC-Printer-01"
```

Advertise as "TSC-Printer-01" to BT pairing hosts

## BT PIN — Bluetooth Pairing PIN

⚠️ Credential — appears in label source; do NOT commit to public repositories. Sets the Bluetooth legacy-pairing PIN (BT 2.1+EDR), typically a 4-digit numeric string. Modern Bluetooth SSP (Simple Secure Pairing) doesn't use a static PIN — on SSP-only firmware this command may document as a no-op. Not in the 2009 TSPL2 PG; refer to the target model's BT setup addendum.

- Category: config
- Syntax: `BT PIN "<pin>"`
- Preview supported: no
- Canonical HTML: https://rfid.me/reference/tspl/bt-pin/

When to use: When provisioning a BT-equipped TSC printer that uses legacy pairing and you need to set a non-default PIN. Treat the PIN as a credential: keep label sources containing it out of version control or commit-time secret scanners.

Parameters:

- `pin`: Quoted PIN string. Typically 4-digit numeric per BT 2.1+EDR legacy pairing.

Example:

```text
BT PIN "1234"
```

Set the legacy-pairing PIN to "1234"

## WLAN — Wi-Fi Configuration Dispatcher

Generic Wi-Fi configuration dispatcher. The first word after WLAN picks the sub-action — SSID sets the network name, PSK sets the WPA passphrase, ENCRYPTION picks the security mode, IP/GATEWAY/NETMASK/DNS configure a static-IP profile, and DHCP toggles automatic addressing (which overrides the static-IP commands). Not in the 2009 TSPL2 PG: Wi-Fi is an optional module on later TSC models (TX/TE/MH-series and Alpha-series with optional Wi-Fi) and the commands are documented in per-model WLAN setup addenda. Engine-recognised but not rendered — labels with WLAN configure the printer hardware rather than producing label content.

- Category: config
- Syntax: `WLAN <sub-action> <args>`
- Preview supported: no
- Canonical HTML: https://rfid.me/reference/tspl/wlan/

When to use: When provisioning a Wi-Fi-equipped TSC printer in-band as part of a label setup script. Pair `WLAN SSID` + `WLAN ENCRYPTION` + `WLAN PSK` for WPA networks, or set `WLAN DHCP ON` to use a DHCP server's addressing.

Parameters:

- `sub-action`: The Wi-Fi setting to configure (case-insensitive). Values: `SSID` (Wi-Fi network name (ESSID)), `PSK` (WPA/WPA2/WPA3 pre-shared key passphrase (credential)), `ENCRYPTION` (Security mode (OPEN, WEP, WPA, WPA2, WPA3, …)), `IP` (Static IPv4 address (ignored when DHCP=ON)), `DHCP` (Toggle DHCP client mode (ON/OFF)), `GATEWAY` (Default-gateway IPv4 address (ignored when DHCP=ON)), `NETMASK` (Subnet mask (ignored when DHCP=ON)), `DNS` (Primary DNS server address (ignored when DHCP=ON)).
- `args`: Sub-action-specific arguments — see the individual WLAN <sub-action> entries

Example:

```text
WLAN SSID "OfficeWiFi"
WLAN ENCRYPTION WPA2
WLAN PSK "ChangeThisPassphrase"
WLAN DHCP ON
```

Join WPA2 network "OfficeWiFi" with DHCP-assigned addressing

## WLAN SSID — Wi-Fi Network Name

Sets the Wi-Fi network name (ESSID) the printer joins. Verify any length limits and allowed characters against the target model's WLAN setup addendum.

- Category: config
- Syntax: `WLAN SSID "<ssid>"`
- Preview supported: no
- Canonical HTML: https://rfid.me/reference/tspl/wlan-ssid/

When to use: When provisioning a Wi-Fi-equipped TSC printer to join a specific access point. Pair with WLAN ENCRYPTION + WLAN PSK on WPA networks.

Parameters:

- `ssid`: Quoted network name (ESSID).

Example:

```text
WLAN SSID "OfficeWiFi"
```

Set the target Wi-Fi network name

## WLAN PSK — Wi-Fi Pre-Shared Key

⚠️ Credential — appears in label source; do NOT commit to public repositories. Sets the WPA/WPA2/WPA3 pre-shared key passphrase (8–63 ASCII characters per IEEE 802.11i, or a 64-hex-char raw PSK). Effective only when `WLAN ENCRYPTION` is set to a WPA-family mode.

- Category: config
- Syntax: `WLAN PSK "<passphrase>"`
- Preview supported: no
- Canonical HTML: https://rfid.me/reference/tspl/wlan-psk/

When to use: Together with WLAN SSID and WLAN ENCRYPTION to join a WPA-secured network. Treat the passphrase as a credential: keep label sources containing it out of version control or run them through a commit-time secret scanner.

Parameters:

- `passphrase`: Quoted WPA passphrase (8–63 ASCII chars) or raw 64-hex-char PSK.

Example:

```text
WLAN PSK "ChangeThisPassphrase"
```

Set the WPA pre-shared key

## WLAN ENCRYPTION — Wi-Fi Security Mode

Selects the Wi-Fi security mode the printer uses to associate. OPEN is unencrypted; WEP is legacy and insecure; WPA / WPA2 / WPA3 are the modern pre-shared-key modes (PSK comes from `WLAN PSK`). Enterprise-capable firmware may also accept WPA2-ENTERPRISE / WPA-EAP, which require certificate-handling sibling commands per the model's addendum. Verify exact spelling against the target model's WLAN setup addendum.

- Category: config
- Syntax: `WLAN ENCRYPTION <mode>`
- Preview supported: no
- Canonical HTML: https://rfid.me/reference/tspl/wlan-encryption/

When to use: Once per Wi-Fi profile, before `WLAN PSK`. Must match the access point's configured security mode or association will fail.

Parameters:

- `mode`: Wi-Fi security mode (case-insensitive). Values: `OPEN` (No encryption — for open networks only), `WEP` (Legacy WEP — insecure; avoid unless required by hardware), `WPA` (WPA-PSK (TKIP)), `WPA2` (WPA2-PSK (CCMP/AES) — recommended baseline), `WPA3` (WPA3-Personal (SAE) — if supported by firmware and AP).

Example:

```text
WLAN ENCRYPTION WPA2
```

Select WPA2-PSK as the Wi-Fi security mode

## WLAN IP — Wi-Fi Static IP Address

Sets the static IPv4 address the Wi-Fi interface uses when DHCP is off. Ignored at boot when `WLAN DHCP ON` has been issued in the same profile.

- Category: config
- Syntax: `WLAN IP "<ipv4>"`
- Preview supported: no
- Canonical HTML: https://rfid.me/reference/tspl/wlan-ip/

When to use: Only for static-IP deployments — typically paired with WLAN NETMASK + WLAN GATEWAY + WLAN DNS. Skip this command and use `WLAN DHCP ON` for DHCP-assigned addressing.

Parameters:

- `ipv4`: Quoted dotted-quad IPv4 address (e.g. "192.168.1.50").

Example:

```text
WLAN DHCP OFF
WLAN IP "192.168.1.50"
WLAN NETMASK "255.255.255.0"
WLAN GATEWAY "192.168.1.1"
```

Configure a static IPv4 address

## WLAN DHCP — Wi-Fi DHCP Toggle

Toggles DHCP client mode on the Wi-Fi interface. When ON, the printer obtains an IP/gateway/netmask/DNS automatically and the static-IP commands (`WLAN IP`, `WLAN GATEWAY`, `WLAN NETMASK`, `WLAN DNS`) are ignored at boot. When OFF, the static-IP commands take effect.

- Category: config
- Syntax: `WLAN DHCP ON \| WLAN DHCP OFF`
- Preview supported: no
- Canonical HTML: https://rfid.me/reference/tspl/wlan-dhcp/

When to use: At most once per Wi-Fi profile. Default to `ON` for DHCP-managed networks; switch to `OFF` only when the deployment requires static addressing.

Parameters:

- `state`: DHCP client mode (case-insensitive). Values: `ON` (Obtain IP/gateway/netmask/DNS via DHCP — static-IP commands are ignored), `OFF` (Use the static-IP commands (WLAN IP, GATEWAY, NETMASK, DNS)).

Example:

```text
WLAN DHCP ON
```

Use DHCP for IPv4 addressing

## WLAN GATEWAY — Wi-Fi Default Gateway

Sets the default-gateway IPv4 address the Wi-Fi interface routes traffic through when DHCP is off. Ignored at boot when `WLAN DHCP ON` has been issued.

- Category: config
- Syntax: `WLAN GATEWAY "<ipv4>"`
- Preview supported: no
- Canonical HTML: https://rfid.me/reference/tspl/wlan-gateway/

When to use: Together with WLAN IP + WLAN NETMASK for static-IP deployments.

Parameters:

- `ipv4`: Quoted dotted-quad IPv4 address of the default gateway.

Example:

```text
WLAN GATEWAY "192.168.1.1"
```

Route traffic via 192.168.1.1

## WLAN NETMASK — Wi-Fi Subnet Mask

Sets the IPv4 subnet mask the Wi-Fi interface uses when DHCP is off. Ignored at boot when `WLAN DHCP ON` has been issued.

- Category: config
- Syntax: `WLAN NETMASK "<ipv4>"`
- Preview supported: no
- Canonical HTML: https://rfid.me/reference/tspl/wlan-netmask/

When to use: Together with WLAN IP + WLAN GATEWAY for static-IP deployments.

Parameters:

- `ipv4`: Quoted dotted-quad subnet mask (e.g. "255.255.255.0").

Example:

```text
WLAN NETMASK "255.255.255.0"
```

Use a /24 subnet mask

## WLAN DNS — Wi-Fi DNS Server

Sets the primary DNS server IPv4 address the Wi-Fi interface uses for hostname resolution when DHCP is off. Ignored at boot when `WLAN DHCP ON` has been issued.

- Category: config
- Syntax: `WLAN DNS "<ipv4>"`
- Preview supported: no
- Canonical HTML: https://rfid.me/reference/tspl/wlan-dns/

When to use: Together with the other static-IP commands when the deployment can't rely on DHCP for DNS, or to override DHCP-supplied DNS on networks that mishandle it.

Parameters:

- `ipv4`: Quoted dotted-quad IPv4 address of the primary DNS server.

Example:

```text
WLAN DNS "8.8.8.8"
```

Use 8.8.8.8 as the primary DNS resolver
