Go API for BLE thermal printers. Print text, images, barcodes, receipts, and more.
- Text: auto-wrap, alignment (left/center/right), bold, custom font size
- Emoji: full Unicode emoji support (auto-downloaded from Google Noto)
- Images: Floyd-Steinberg dithering, ASCII art mode, invert colors
- Barcodes: Code128, Code39, EAN-13, QR codes
- Templates: receipts, tables, calendar day views
- GitHub PR: print PR details as a receipt
- Multiple copies:
?times=Non all endpoints - API key auth: optional
?key=authentication - CLI + HTTP API: use from terminal or as a service
Tested with cat-style BLE thermal printers:
- X6h-8BA5 (default)
- Other 384px-wide BLE printers using the same protocol
make buildOr download binaries from Releases.
./bin/print "Hello World"
./bin/print --align center "Centered text"
./bin/print --image photo.jpg./bin/server --port 8080
./bin/server --port 8080 --api-key mysecret # with auth| Endpoint | Method | Description |
|---|---|---|
/ |
GET | Health check |
/print |
POST | Mixed content (text + images) |
/print/text |
POST | Plain text |
/print/image |
POST | Image from URL |
/print/barcode |
POST | Barcode/QR code |
/print/receipt |
POST | Receipt template |
/print/table |
POST | Table template |
/print/calendar |
POST | Calendar day view |
/print/pr |
POST | GitHub PR receipt |
/feed |
POST | Feed paper |
All print endpoints support:
?times=N- print N copies (1-10)?key=XXX- API key (if auth enabled)
# Text
curl -X POST "localhost:8080/print/text?text=Hello"
# Image with ASCII art mode
curl -X POST "localhost:8080/print/image?url=https://example.com/img.png&mode=ascii"
# Image inverted (white on black)
curl -X POST "localhost:8080/print/image?url=https://example.com/logo.png&invert=true"
# QR Code
curl -X POST "localhost:8080/print/barcode?data=https://example.com&type=qr"
# Receipt (2 copies)
curl -X POST "localhost:8080/print/receipt?times=2" \
-H "Content-Type: application/json" \
-d '{"header":"STORE","items":[{"name":"Item","quantity":1,"price":9.99}],"total":9.99}'
# GitHub PR
curl -X POST "localhost:8080/print/pr?url=https://github.com/owner/repo/pull/1"See EXAMPLES.md for full documentation and more examples
Edit internal/config/config.go:
PrinterConfig{
DeviceName: "X6h-8BA5", // BLE device name
Speed: 15, // 10-90, lower = better quality
Energy: 14000, // higher = darker
PaperWidth: 384,
CommandDelay: 20, // ms between commands
DPI: 50,
}- Fork the repo
- Create a feature branch
- Submit a PR
This project was vibe coded with zero prior Go knowledge. Built entirely through AI-assisted development. If you see something cursed, that's why. PRs welcome.
MIT