This repository has been archived on 2026-11-24. You can view files and clone it. You cannot open issues or pull requests or push a commit.
randy 320679cedd
deploy / deploy (push) Successful in 7s
Labelburg instead of Labelhaus: the project was renamed again
The proxy and links are below /labelburg, /labelhaus and /brother are
redirected there.
2026-11-09 20:24:11 +01:00

labelprint

Unified UI for printing labels/receipts:

  • Native ZPL printing to a Datamax-ONeil thermal barcode printer

  • A proxy in front of brother_ql_web (port 8013), which drives all Brother QL printers

  • ESC/POS receipt printing to an Epson TM-T20II

Routes

  • / — home page, links to everything below

  • /upload, POST /upload — upload a PDF/ZPL file and print it (Datamax). PDF pages wider than the A6 label (e.g. letter pages or labels in landscape) are turned and fitted onto it, others print 1:1.

  • POST /shipping/zpl — print raw ZPL text (see "API usage" below)

  • /test-print — print the bundled Datamax test label

  • /epson — receipt printing UI (title/body/QR template, or raw ESC/POS mnemonic notation)

  • POST /epson/print — print a title/body/QR receipt

  • POST /epson/raw — print already-formatted ESC/POS mnemonic notation (see "API usage" below)

  • POST /epson/test-print — print an Epson capability test page (text sizes, barcode, QR, raster image)

  • /labels — shared repository of saved ZPL labels / ESC-POS receipts (list, edit, preview, print, delete)

  • /brother/* — proxied to brother_ql_web (UI and API alike), the printer is chosen in its label designer

API usage (e.g. from Gitea Actions)

POST /shipping/zpl and POST /epson/raw are plain, unauthenticated form-POST endpoints — no session/login needed, and printing without a save_as/commit param just prints (nothing gets kept in the label repository). That makes labelprint usable as a "dumb" print API for other automation: it doesn’t need to know anything about the caller, and the caller doesn’t need any labelprint-specific client, just an HTTP form POST.

Example: randy/home-gitops has a workflow (.gitea/workflows/print-issues.yaml + scripts/print_issues.rb) that fetches its own open issues via the Gitea API and prints a summary on the Epson receipt printer — the Gitea-specific logic (fetching, formatting) lives entirely in that script, not here:

require 'net/http'

res = Net::HTTP.post_form(
  URI('http://rpi-printserver.hv.priesol.net/epson/raw'),
  'content' => "ESC E 0x01\nHello from CI\nESC E 0x00\nLF"
)

content uses labelprint’s mnemonic ESC/POS notation: ESC/GS/FS/LF/CR/HT/NUL as command names, 0xNN as a raw byte, anything else as literal text (CP852-encoded) — see the /epson page for the full reference and worked examples (alignment, bold, barcodes). POST /shipping/zpl works the same way but with a zpl form field taking plain ZPL instead.

Running

bundle install
bundle exec ruby app.rb

Requires config.json (see printer definitions inside) and a .session_secret file (random string, not committed).

Deployment

Runs as sinatra.service (systemd) on rpi-printserver.hv.priesol.net, under RVM (rvm default do bundle exec ruby app.rb — always uses whatever ruby is currently the RVM default, no manual bumping needed).

.gitea/workflows/deploy.yaml deploys on every push to main: SSH into rpi-printserver.hv.priesol.net, git pull, bundle install, restart the service.

Dependency updates

.gitea/workflows/renovate.yaml runs Renovate on a schedule (Monday 06:00 Europe/Bratislava, or manually) to open PRs for outdated gems and GitHub Actions. See the "Dependency Dashboard" issue for current status.

The print server works without internet: Bootstrap, Material Design Icons and Dropzone are in public/vendor/<name>-<version>/ (unchanged release files from jsdelivr/unpkg, without source maps; MDI only with the WOFF2 and WOFF fonts). Renovate does not update them, a new version is a new folder plus the paths in views/layout.erb (and app.rb for the MDI stylesheet of the proxied brother_ql_web pages). nginx-502.html is self-contained, nginx serves it from /etc/nginx/error_pages/502.html while the app is down. Only the ZPL preview in /labels needs internet (Labelary API).

S
Description
Unified label/sticker printing UI (Datamax ZPL + multiple Brother QL printers)
Readme
1.4 MiB
0 Stars 1 Watchers 0 Forks
Languages
Ruby 66.1%
HTML 33.9%