BlueGit

timfa posprint

Files

posprint / docs / LABEL-PRINTERS.md

LABEL-PRINTERS.md

LABEL-PRINTERS.md 1.9 KiB Download Raw

Label printers (TSPL/TSPL2) — experimental

Branch experimental/tspl2. Receipt printers (ESC/POS) behave exactly as before; this only adds a second output language for label printers such as the Altec ATP-300 Pro (USB 1203:0231, MFG:Altec;CMD:TSPL2;MDL:ATP-300 Pro;).

Protocol detection (automatic)

1. The printer's IEEE 1284 device ID (CMD: field): read from Linux sysfs (ieee1284_id) or with the USB printer-class GET_DEVICE_ID request. TSPL* → TSPL. If ESC/POS is also listed, ESC/POS is used. 2. No device ID but USB vendor 0x1203 (TSC/Altec) → TSPL. 3. Windows queue name containing TSPL, Altec ATP or TSC → TSPL. 4. Otherwise ESC/POS (unchanged default).

Label format

The print dialog shows a Label printer section only for TSPL printers. The first time a model is used it asks width, height, gap/black mark/continuous, resolution and rotation, pre-filled from the printer when it answers GETSETTING$("CONFIG","TSPL","PAPER WIDTH" / "PAPER SIZE" / "GAP SIZE") and GETSETTING$("SYSTEM","INFORMATION","DPI") over bidirectional USB (values are only used when the reply has an explicit unit). The format is stored per model in label_formats.json next to config.json. "Let the printer measure the labels first" sends GAPDETECT x,y / BLINEDETECT x,y once.

Output

The page is encoded with the unchanged ESC/POS encoder, rendered to a bitmap (Font A 12×24 grid, alignment, double size, bold, raster images, barcodes, QR), scaled to the label resolution (8 → 12 dots/mm at 300 dpi, shrunk to fit the label width), centred, split over labels (@cut = next label, long pages over several labels) and sent as:

SIZE w mm,h mm
GAP g mm,0 mm        (BLINE g mm,0 mm / GAP 0,0)
DIRECTION 0,0
REFERENCE 0,0
CLS
BITMAP x,0,wbytes,h,0,<1-bit data, 0 = black>
PRINT 1,1

cargo run --example tspl_preview -- file.pos out 100 50 3 300 writes PNG previews and the .prn job without a printer.

Source
1# Label printers (TSPL/TSPL2) — experimental
2
3Branch `experimental/tspl2`. Receipt printers (ESC/POS) behave exactly as before;
4this only adds a second output language for label printers such as the
5Altec ATP-300 Pro (USB 1203:0231, `MFG:Altec;CMD:TSPL2;MDL:ATP-300 Pro;`).
6
7## Protocol detection (automatic)
8
91. The printer's IEEE 1284 device ID (`CMD:` field): read from Linux sysfs
10 (`ieee1284_id`) or with the USB printer-class `GET_DEVICE_ID` request.
11 `TSPL*` → TSPL. If ESC/POS is also listed, ESC/POS is used.
122. No device ID but USB vendor 0x1203 (TSC/Altec) → TSPL.
133. Windows queue name containing `TSPL`, `Altec ATP` or `TSC` → TSPL.
144. Otherwise ESC/POS (unchanged default).
15
16## Label format
17
18The print dialog shows a *Label printer* section only for TSPL printers. The
19first time a model is used it asks width, height, gap/black mark/continuous,
20resolution and rotation, pre-filled from the printer when it answers
21`GETSETTING$("CONFIG","TSPL","PAPER WIDTH" / "PAPER SIZE" / "GAP SIZE")` and
22`GETSETTING$("SYSTEM","INFORMATION","DPI")` over bidirectional USB (values are
23only used when the reply has an explicit unit). The format is stored per model
24in `label_formats.json` next to `config.json`. "Let the printer measure the
25labels first" sends `GAPDETECT x,y` / `BLINEDETECT x,y` once.
26
27## Output
28
29The page is encoded with the unchanged ESC/POS encoder, rendered to a bitmap
30(Font A 12×24 grid, alignment, double size, bold, raster images, barcodes, QR),
31scaled to the label resolution (8 → 12 dots/mm at 300 dpi, shrunk to fit the
32label width), centred, split over labels (`@cut` = next label, long pages over
33several labels) and sent as:
34
35```
36SIZE w mm,h mm
37GAP g mm,0 mm (BLINE g mm,0 mm / GAP 0,0)
38DIRECTION 0,0
39REFERENCE 0,0
40CLS
41BITMAP x,0,wbytes,h,0,<1-bit data, 0 = black>
42PRINT 1,1
43```
44
45`cargo run --example tspl_preview -- file.pos out 100 50 3 300` writes PNG
46previews and the `.prn` job without a printer.