Skip to content

Instantly share code, notes, and snippets.

@kedare
Created September 6, 2021 15:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kedare/c21e00aff22ef77a035fde2be91b57f0 to your computer and use it in GitHub Desktop.
Save kedare/c21e00aff22ef77a035fde2be91b57f0 to your computer and use it in GitHub Desktop.
import escpos.printer
import sys
text = sys.argv[1]
if len(text) > 16:
print("Text cannot be longer than 16 characters")
sys.exit(1)
print("Connecting to printer")
p = escpos.printer.File("/dev/usb/lp0")
print("Printing")
p.set(double_height=True, double_width=True)
p.textln(text)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment