master
Your Name 6 years ago
parent d8bfa3108f
commit 3c749d8fa1

@ -201,13 +201,16 @@ class Printer():
def checkpagebreak(self, printer, exit=False): def checkpagebreak(self, printer, exit=False):
print(self.printedheight) print(self.printedheight)
if self.printedheight+(self.lineheight/216)*4 > 11.69: if self.printedheight+(self.lineheight/216)*4 > 11.69:
printer.write(self.ESC + b"\x33" + bytes([self.lineheight]));
printer.write(self.LINE_FEED) printer.write(self.LINE_FEED)
printer.write(self.LINE_FEED) printer.write(self.LINE_FEED)
printer.write(bytes(str("PAGE "+str(self.pages)), 'utf-8')); printer.write(bytes(str("PAGE "+str(self.pages)), 'utf-8'));
printer.write(self.ESC + b"\x33" + bytes([self.lineheight]));
printer.write(self.LINE_FEED) printer.write(self.LINE_FEED)
printer.write(self.LINE_FEED) printer.write(self.LINE_FEED)
printer.write(self.LINE_FEED) printer.write(self.LINE_FEED)
printer.write(self.ESC + b"\x33" + bytes([20]));
printer.write(self.LINE_FEED)
printer.write(self.ESC + b"\x33" + bytes([self.lineheight]));
if not exit: if not exit:
printer.write(self.COMPRON) printer.write(self.COMPRON)
printer.write(bytes(str("------------------------------------------------------ POETIC SOFTWARE PUBLICATION -----------------------------------------------------"), 'utf-8')); printer.write(bytes(str("------------------------------------------------------ POETIC SOFTWARE PUBLICATION -----------------------------------------------------"), 'utf-8'));
@ -244,8 +247,9 @@ class Printer():
with open('/dev/usb/lp0', 'wb') as printer: with open('/dev/usb/lp0', 'wb') as printer:
printer.write(self.ESC + b"\x33" + bytes([11])); printer.write(self.ESC + b"\x33" + bytes([11]));
for _ in range(int(((imagelines*22)%self.lineheight)/11)): for _ in range(int(((imagelines*22)%self.lineheight)/11)):
printer.write(self.LINE_FEED) self.checkpagebreak(printer)
self.printedheight += (11/216) self.printedheight += (11/216)
printer.write(self.LINE_FEED)
print(imagelines) print(imagelines)
print(((imagelines*22)%self.lineheight)/11) print(((imagelines*22)%self.lineheight)/11)
printer.write(self.ESC + b"\x33" + bytes([self.lineheight])); printer.write(self.ESC + b"\x33" + bytes([self.lineheight]));

Loading…
Cancel
Save