Writing your own CUPS printer driver in 100 lines of Python
a year ago
- #ticket-printing
- #cups-driver
- #python
- pretix 1.8 introduced shipping management for tickets via snail mail, ideal for high-quality physical tickets.
- Tested thermal ticket printers: BOCA Lemur and Practical Automation uITL+2003CF, with uITL+ chosen for affordability and design.
- uITL+ lacks a network port and only has a Windows driver, unlike BOCA's multi-platform support.
- Both printers use FGL (Friendly Ghost Language) for communication, requiring a custom driver for Linux.
- Developed a CUPS printer driver in Python (rastertofgl) to convert CUPS Raster Format to FGL for the uITL+ printer.
- Used Python for the driver to avoid cross-compilation issues, leveraging Pillow for image processing (dithering, rotation).
- Created a PPD file using CUPS's ppdc tool to define printer settings, including paper sizes and cutter options.
- Driver packages available for Arch Linux and Debian, with source code on GitHub.
- Noted issue: Filter fails with GTK-based PDF viewers but works with command-line printing.
- Offers ticket printing and shipping solutions via pretix, including printer and paper sales.