# P-touch Labels for Asset Barcode label printing for **Brother P-touch EDGE PT-E560BT** asset tags. Generates a three-column label sized to the printer's real printable area, with a logo, three lines of fixed text plus a variable field, and a QR code that encodes a composed string. Includes a preview that matches the print exactly, and a Kivy GUI for operators. ``` 0 20 mm 45 mm 63 mm +---------+------------+--------+ | | static 1 | QR | | LOGO | static 2 | CODE | | 16x16 | static 3 | | | | VARIABLE | | +---------+------------+--------+ ``` ## Install ```bash pip install -r requirements_ptouch.txt ``` ## Run ```bash python label_printer_ptouch_gui.py # operator GUI (Kivy) ``` The original three-row format is still available via `label_printer_gui.py` and is unchanged. ## Configuration Operator settings live in `label_config.json` (not committed - it holds a local logo path). Edit them in **Advanced settings** in the GUI: | Setting | Purpose | |---|---| | Logo image | PNG/JPG for the first column, with a thumbnail preview | | Static text lines | The three fixed lines | | Code prefix / suffix | Code payload is `prefix + inventory + suffix` | | QR error correction | `L` (shortest) to `H` (most robust) | ## Hardware notes The PT-E560BT has a **128-dot print head at 180 dpi**, so the maximum print height is **18.06 mm** even on 24 mm tape. The label is therefore fitted to the driver's *printable area* (~61 x 18 mm), read at runtime, rather than to the nominal media size (65 x 24 mm). The driver exposes two resolution modes; use the symmetric one: ```bash python set_printer_resolution.py --mode 180 ``` See [documentation/PTOUCH_63x20.md](documentation/PTOUCH_63x20.md) for the full layout, code-composition and dot-alignment details. ## Diagnostics | Script | Purpose | |---|---| | `check_print_area.py` | Driver page and printable area (authoritative `GetDeviceCaps`) | | `check_print_geometry.py` | Compares our PDF page against the driver's media | | `check_devmode.py` | Dumps the full driver DEVMODE | | `set_printer_resolution.py` | Read/switch the driver resolution mode | | `print_calibration.py` | Label with ruler marks, for measuring on tape | | `print_measure_scale.py` | Measures the actual X/Y scale factors | | `capture_print_job.py` | Captures raw bytes sent to the printer | ## Tests ```bash python validate_ptouch_layout.py # geometry + QR round-trip from rendered pixels python test_ptouch_pipeline.py # config, PDF, print path (uses a temp config) python test_gui_layout.py # GUI wiring, headless python test_print_reporting.py # print failures are reported honestly ``` `validate_ptouch_layout.py` decodes the QR back out of the rendered preview, module by module, which is what proves the preview and the PDF are the same layout and that the symbol survives dot-alignment.