How to use Python ESC/POS printing with Epson TM-T81III inside ERPNext Print Format (Jinja)? #727
Unanswered
FaisalMonsys
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I am trying to print images on an Epson TM-T81III POS printer using Python ESC/POS and Pillow, and I want to integrate this into an ERPNext Print Format (Jinja).
Here is the Python code that works perfectly :
from escpos.printer import Network
from PIL import Image # pip install Pillow if needed
Connect to printer
kitchen = Network("192.168.68.111", profile="TM-T88III")
Load and resize image (maintain aspect ratio)
img_path = "/Users/mondaysys03/Desktop/image_convert/Frame .png"
img = Image.open(img_path).convert('L') # Grayscale for thermal
img_resized = img.resize((512, int(img.height * 512 / img.width)), Image.Resampling.LANCZOS)
resized_path = img_path + '_resized.png'
img_resized.save(resized_path) # Optional: save resized
Print
kitchen.image(resized_path) # Or use '_resized.png'
kitchen.cut()
kitchen.close()
I want to trigger this printing using Jinja or a server-side script or (esc raw command).
How can i do that?
Beta Was this translation helpful? Give feedback.
All reactions