def main(total_price, datetime): try: printer = File(devfile='/dev/usb/lp0') printer.profile.media['width']['pixels'] = 575 printer.image("images/logo-text-small.png", center=True) # printer.image("images/logo-text-small.png") printer.set(align=u'center') printer.text("\n") # printer.text('Your ID: ' + str(user_id) + "\n") printer.text(total_price + " Toman" + "\n") # printer.qr(total_price, size=12, center=True) # printer.text('Support: ' + owner_mobile_number + "\n") # printer.text('ID: ' + str(owner_id) + "\n") printer.text("farazist.ir" + "\n") printer.text(datetime) printer.cut() print("print receipt") except Exception as e: print("error:", e)
from escpos.printer import File printer = File(devfile='/dev/usb/lp0') printer.text("سبسلبلبلل\n") printer.text("some text\n") printer.text("some text\n") printer.text("سبلبلباال\n") # printer.set(codepage='pc864') printer.profile.media['width']['pixels'] = 575 printer.image("images/logo-text-small.png", center=True) # printer.image("images/logo-text-small.png") # printer.set(align=u'center') printer.text("Far" + "\n\n") # printer.text(total_price + " Toman" + "\n") printer.qr('total_price', size=8, center=True) # printer.qr(str(self.total_price), size=8) # printer.text(mobile_number + "\n") printer.text("farazist.ir" + "\n") # printer.text(datetime) printer.cut()