Receipt Printer Server

Receipt Printer Server

Quick documentation on how to use the receipt printer API via receiptprinterd.

Usage

The usages below assume you're using the nixos-media-box machine. If you're running anything else, simply replace the hostname.

Printing Text

To print a simple string:

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

To print a file:

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

To print from stdin:

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

Printing an Image

To print an image:

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

Any image format supported by Pillow will be supported here as well. 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, you can set the brightness filter:

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:

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

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

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

API Documentation