Receipt Printers

**This is an old revision of the document!**

Receipt Printers

We currently have 1 working receipt printer at the space.

Epson TM-T88IV (owner: @diamond)

This receipt printer is an Epson TM-T88IV. It has a Centronics Parallel port at the back. We use a Parallel-to-USB cable with it.

The printed is connected to a Raspberry Pi 4 (hostname nixos-media-box), both located inside the member project rack. The Pi can be found behind or next to the receipt printer.

The Pi hosts receiptprinterd at HTTP path /receipt. This server is capable of automating printing of many content types on the receipt printer. See instructions below on how to use it.

Printing Text

To print a simple string, it should do:

curl -L http://nixos-media-box.local/receipt -F "text=Hello, world!"

To print a file or print from stdin, it should do:

curl -L http://nixos-media-box.local/receipt -F "text=@/path/to/file" echo "Hello, world!" | curl -L http://nixos-media-box.local/receipt -F "text=@-"

Printing an Image

To print an image, it should do:

curl -L http://nixos-media-box.local/receipt/image -F "image=@/path/to/image.jpg"

Any image format supported by Pillow will be supported. This includes JPEG and PNG.

If the image is too wide, it will be automatically shrunk.

If the image is in landscape orientation, it will automatically be rotated to fit the receipt. There is currently no way to turn this off.

If the image is too dark, it can try:

curl -L http://nixos-media-box.local/receipt/image \
   -F "image=@/path/to/image.jpg" \
   -F "brightness=0.85"

For all parameters, see the API documentation for POST /image.

Printing a QR Code

To print a QR code encoding some text, it should do:

curl -L http://nixos-media-box.local/receipt/qr -F "text=youtu.be/xuzKafChH7k"

Printing Without Cutting (Continuous Printing)

By default, after each printing request, the server will command the printer to cut the paper. To change this behavior, add:

-F cut=false

It may also manually command the printer to cut via a request:

curl -L -X POST http://nixos-media-box.local/receipt/cut

API Documentation