This is a practical POS-printer utility: it generates ruler/measurement labels sized for receipt printers and includes a small local web UI for previewing and printing output. It is intended as a focused hardware/software automation example, not as a production POS system.
python3 -m compileall .
python3 pos_ruler.py --helpA professional, high-precision utility for printing mathematically accurate rulers on thermal POS80 printers. Features dual Imperial (1/16") and Metric (1mm) scales, a powerful web GUI, and a guided calibration wizard.
- Extreme Accuracy: Calibrated for high-density printing with 1/16th inch or millimeter precision.
- Dual Scale: Simultaneous Imperial and Metric scales on a single strip.
- Premium Web GUI: A modern, dark-mode interface for effortless setup, calibration, and printing.
- Guided Calibration: Step-by-step wizard to find your printer's exact DPI, correcting for mechanical feed variance.
- Zero-Artifact Output: Uses pre-compiled ESC/POS with paced byte streaming to eliminate stuttering and white lines.
- USB Focus: Optimized exclusively for USB connection to ensure maximum timing precision and accuracy.
- Custom Branding: Vertical branding label running down the center of every ruler.
- Clone the repository.
- Install the required dependencies:
pip install -r requirements.txt
- (macOS/Linux) Ensure you have permission to access USB devices. On macOS, you may need to disable CUPS if it has claimed the printer.
The easiest way to use POS Ruler Printer is through the web interface:
python pos_ruler.py --webThen open http://localhost:5556 in your browser.
For power users or automation, a robust CLI is available:
# Print a 12" ruler
python pos_ruler.py --inches 12
# Print a 30cm ruler with custom branding
python pos_ruler.py --cm 30 --branding "PRECISION TOOLS"
# Run interactive calibration mode
python pos_ruler.py --calibrate
# Save a 36" ruler preview to a file without printing
python pos_ruler.py --save my_ruler.png --inches 36Thermal printers often have slight variances in their mechanical feed rate, causing printed items to be slightly shorter or longer than intended.
POS Ruler Printer solves this with a DPI Correction Factor. By printing a test strip of a known length (e.g., 12") and measuring the physical output, the script calculates the actual DPI of your specific hardware and saves it to config.json.
- Printer: Generic POS80 (80mm) Thermal Printers (e.g., MUNBYN, HOIN, NETUM, etc.)
- Resolution: 203 DPI (8 dots/mm) nominal.
- OS: macOS, Windows, and Linux.
This project is licensed under the MIT License - see the LICENSE file for details.