Jump to content

Foundry Print Server

From /dev/hack
Foundry Print Server
Status Operational
Manufacturer Lenovo
Model Thinkcentre (unknown model)
Owner diamond



The Thinkcentre machine, sitting underneath the receipt printer.

This Thinkcentre machine lives underneath an Epson TM-T88IV Receipt Printer in the Foundry room.

It is in charge of managing the receipt printer when it's not being used (i.e. still plugged in to the machine) and, in the future, the CR805 Card Printer (once we deprecate the Windows machine).

Printing Receipts

The server is capable of automating printing of various content types on the Epson TM-T88IV Receipt Printer.

Printing Text

To print a simple string, do:

curl -L foundryprintsrv.core.devhack.net/receipt -F "text=Hello, world!"

To print a file or print from stdin, do:

curl -L foundryprintsrv.core.devhack.net/receipt -F "text=@/path/to/file"
echo "Hello, world!" | curl -L foundryprintsrv.core.devhack.net/receipt -F "text=@-"

Printing an Image

To print an image, do:

curl -L foundryprintsrv.core.devhack.net/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, you can try:

curl -L foundryprintsrv.core.devhack.net/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, do:

curl -L foundryprintsrv.core.devhack.net/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 foundryprintsrv.core.devhack.net/receipt/cut

API Documentation

See foundryprintsrv.core.devhack.net/receipt/docs.