phpman
phpman

Reputation: 253

python-escpos direct printing text

Hi I´m implementing a python script which should print some text in "realtime" on a little 58mm POS thermal printer. For this I´m using the python-escpos library. Everything runs fine but I find out that the printer starts to print after the script is finished. I cant understand that cause I want to send out diffenrent Epson.text("foobar") command during a loop. At the moment all the text-print-statements are printed after the complete loop (demo loop with some sleep(5)) is finished and I´m back at the command promt.

from escpos import *
from time import sleep

Epson = printer.File("/dev/usb/lp0")

while True:
 Epson.text("Hello World\n")
 sleep(5)

Upvotes: 2

Views: 7068

Answers (1)

Patrick Kanzler
Patrick Kanzler

Reputation: 118

I am currently maintaining python-escpos. (over at https://github.com/python-escpos/python-escpos)

With "File"-printer you have to call printer.flush() at the moment, otherwise the print buffer will not be sent. I have opened an issue whether we should adapt the behaviour to that of the other printers.

Upvotes: 3

Related Questions