Simple python script to print 4x6 PDF/ZPL labels to Omezizy Bluetooth Thermal Label Printer. Used on CachyOS with printer connected over network.
- Python 100%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
Add printlabel.py, README, and .gitignore. Make printer host/port configurable via LABEL_PRINTER_HOST/PORT env vars. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> |
||
| .gitignore | ||
| printlabel.py | ||
| README.md | ||
label-maker
Render a PDF and print it to a network thermal label printer that speaks TSPL over a raw socket (JetDirect port 9100).
Built for 4" × 6" shipping labels on a 203 DPI direct-thermal printer.
How it works
printlabel.py takes a PDF, rasterizes each page to 1-bit mono with
pdftoppm, then wraps the bitmap in a TSPL job (SIZE / GAP / BITMAP /
PRINT) and streams it to the printer on TCP port 9100.
Requirements
- Python 3
pdftoppm(from Poppler) on yourPATH- A TSPL-compatible network printer reachable over TCP
On Debian/Ubuntu: sudo apt install poppler-utils
Usage
./printlabel.py label.pdf
The printer address defaults to 100.64.13.61:9100. Override it without editing
the script:
LABEL_PRINTER_HOST=192.168.1.50 LABEL_PRINTER_PORT=9100 ./printlabel.py label.pdf
Configuration
Tunable constants at the top of printlabel.py:
| Name | Default | Notes |
|---|---|---|
DPI |
203 |
Set to 300 for 300 DPI printers |
LABEL_W, LABEL_H |
4.0, 6.0 |
Label size in inches |
GAP |
0.12 |
Inter-label gap in inches |
Progress (page dimensions in dots) and any printer response are written to stderr.