Skip to content

pzzzy/pos-ruler-printer

Repository files navigation

POS Ruler Printer 📏

License: MIT

Portfolio Notes

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.

Verification

python3 -m compileall .
python3 pos_ruler.py --help

Python 3.8+

A 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.

Key Features

  • 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.

Installation

  1. Clone the repository.
  2. Install the required dependencies:
    pip install -r requirements.txt
  3. (macOS/Linux) Ensure you have permission to access USB devices. On macOS, you may need to disable CUPS if it has claimed the printer.

Getting Started

Launch the Web GUI (Recommended)

The easiest way to use POS Ruler Printer is through the web interface:

python pos_ruler.py --web

Then open http://localhost:5556 in your browser.

Command Line Interface

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 36

How It Works: Calibration

Thermal 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.

Supported Hardware

  • Printer: Generic POS80 (80mm) Thermal Printers (e.g., MUNBYN, HOIN, NETUM, etc.)
  • Resolution: 203 DPI (8 dots/mm) nominal.
  • OS: macOS, Windows, and Linux.

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

POS receipt-printer ruler/label generator with a local web UI

Topics

Resources

License

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors