Skip to content

Latest commit

 

History

History
119 lines (84 loc) · 2.25 KB

File metadata and controls

119 lines (84 loc) · 2.25 KB

CGI Receipt Printer

Usage

Get printer status

curl http://example.com/cgi/print
{"online": true, "paper_empty": false, "paper_low": false}

Print Text

curl http://example.com/cgi/print -d 'Hello World'
curl http://example.com/cgi/print -d '{b}Hello{} World'

will print "Hello World"

("Hello" will be bold. "World" will be regular.)

curl http://example.com/cgi/print -d '{b}Hello {b,u}World'

will print "Hello World"

("Hello" will be bold. "World" will be bold and underlined.)

Text formatting tags:

tag description
c align center
r align right
l align left
b bold
u underline
i invert
f flip (upside-down)
w width (e. g. w=3)
h height (e. g. h=4)
ft font (e. g. ft=a)
ln linefeed

Print Barcode

curl http://example.com/cgi/print -d '{bc}978020137962'

will print the EAN-13 Barcode 978020137962

Barcode formatting tags:

tag description
t type (EAN13, UPC, etc.)
w width (1-255)
h height (1-255)
p position of the text (above, below, both, off)
ft font
c align center
l align left

Print QR Code

curl http://example.com/cgi/print -d '{qr}https://example.com/'

will print the QR Code for https://example.com/

QR Code formatting tags:

tag description
c align center
s size (1-16)
ec error correction (L, M, Q, H)

Print Image

curl http://example.com/cgi/print -d '{im}https://example.com/image.png'

will print the image at https://example.com/image.png

curl http://example.com/cgi/print -d "{im}$(cat image.png | base64)"

will print the image image.png

Image formatting tags:

tag description
c align center

Special Tags

tag description
cut cut the paper
cd kick the cash drawer (d=2 and d=5 supported for pin 2 and 5)

Query Parameters

  • ?cut=0 disables automatic cutting after each request
  • ?feed=0 disables automatic linefeed after each request