A library to interact with some BLE thermal printers from Go, and a CLI application that uses it
Go to file
2024-09-10 22:45:30 +02:00
cli First commit 2024-09-10 22:45:30 +02:00
examples First commit 2024-09-10 22:45:30 +02:00
ble.go First commit 2024-09-10 22:45:30 +02:00
commands.go First commit 2024-09-10 22:45:30 +02:00
demo.jpg First commit 2024-09-10 22:45:30 +02:00
go.mod First commit 2024-09-10 22:45:30 +02:00
go.sum First commit 2024-09-10 22:45:30 +02:00
image.go First commit 2024-09-10 22:45:30 +02:00
lib.go First commit 2024-09-10 22:45:30 +02:00
LICENSE First commit 2024-09-10 22:45:30 +02:00
options.go First commit 2024-09-10 22:45:30 +02:00
README.md First commit 2024-09-10 22:45:30 +02:00

A printer which has just printed a Gopher

go-catprinter is a driver and CLI application that allows you to use some BLE printers, known as "cat printers", on Linux and MacOS, without needing to use the official app.

Documentation

CLI

Grab a binary from the Releases page. Use ./catprinter --help for help.

  • Basic example with provided MAC: ./catprinter --mac 41:c2:6f:0f:90:c7 --image ./gopher.png
  • Basic example with auto discovery by name: ./catprinter --name X6h --image ./gopher.png

Driver

For extensive documentation, please consult the Go Reference. Check the examples/ directory for examples:

  • examples/00-knownMac.go: Shows how to connect to a printer by its MAC address and print a file
  • examples/01-unknownMac.go: Shows how to connect to a printer by its name address and print a file
  • examples/02-options.go: Shows how PrinterOptions can be used to create a rich printing experience with previews and user interaction

Information

Printer compatibility

This software should be compatible with printers whose official apps are iPrint, Tiny Print and similar.
Probably more printers work, but it's hard to tell with how fragmented the ecosystem is. Some printers with these apps might not work. The project takes no responsibility as per the LICENSE.

The project's main developer uses a X6h (the one in the top of the README). It can be found in AliExpress bundles for around ~€8.

Thanks to...

  • rbaron/catprinter and NaitLee/Cat-Printer, for providing most of the printer commands and inspiration for the project
  • Shenzhen Frog To Sea Technology Co.,LTD
  • Everyone who contributed, tested or used this software!

Alternatives

  • NaitLee/Cat-Printer - the cat printer central, with a CLI application, a web UI, CUPS/IPP support and an Android app. The code is a bit more cluttered, but it works well.
  • rbaron/catprinter - simple CLI application for cat printers with batteries included, written in Python with code that's easy to understand.
  • NaitLee/kitty-printer - a web app for cat printers which leverages Web Bluetooth
  • jhbruhn/catprint-rs - a driver for cat printers with a basic CLI utility, written in Rust