Add printer code

This commit is contained in:
jimmy 2022-11-04 14:51:04 +13:00
parent 51d8ada1d8
commit 6b905ef5e5
1 changed files with 17 additions and 0 deletions

17
printer.py Normal file
View File

@ -0,0 +1,17 @@
import StarTSPImage
from PIL import Image, ImageDraw, ImageFont, ImageOps
import textwrap
import random
def printer():
im = Image.new("RGB", (800, 1280), (0, 0, 0))
# im.show()
raster = StarTSPImage.imageToRaster(im, cut=True)
printer = open('/dev/usb/lp0', "wb")
printer.write(raster)
if __name__ == "__main__":
printer()