Closed immdav closed 3 years ago
hi @wellnotanaccount can you share your peace of code to reproduce this problem?
Hello @anastaciocintra, I'm using the sample code.
PrintService printService = PrinterOutputStream.getPrintServiceByName("58 Printer");
PrinterOutputStream printerOutputStream = new PrinterOutputStream(printService);
EscPos escpos = new EscPos(printerOutputStream);
escpos.writeLF("Test Test Test Test Test");
escpos.write("Test Test Test Test Test");
escpos.feed(5);
escpos.cut(EscPos.CutMode.FULL);
escpos.close();
EscPos escpos1 = new EscPos(System.out);
escpos1.writeLF("Test Test Test Test Test");
escpos1.feed(5);
escpos1.cut(EscPos.CutMode.FULL);
escpos1.close();
It is printing well in mine printer (epson tm-t20)
maybe your printer doesn't have text style capabilities. You can try another way to style the text.
PrintService printService = PrinterOutputStream.getPrintServiceByName("tm-t20-usb" );
PrinterOutputStream printerOutputStream = new PrinterOutputStream(printService);
EscPos escpos = new EscPos(printerOutputStream);
// escpos.writeLF("Test Test Test Test Test");
// escpos.write("Test Test Test Test Test");
PrintModeStyle normal = new PrintModeStyle();
escpos.writeLF(normal,"hello normal PrintModeStyle");
PrintModeStyle rightBold = new PrintModeStyle().setBold(true).setJustification(EscPosConst.Justification.Right);
escpos.writeLF(rightBold,"Right bold");
escpos.feed(5).cut(EscPos.CutMode.FULL);
escpos.close();
more on https://github.com/anastaciocintra/escpos-coffee/wiki/Text-Styles
I hope that it will work. see you
weird.. I ran the code you gave.. Normal Style works but not on the 2nd line(Right Bold) I tried to style both lines with normal but 2nd line still shows '0' on the last next line.
escpos.writeLF(normal,"hello normal PrintModeStyle");
escpos.writeLF(normal,"Right bold");
I'm using Rongta RP58, the printer self-test shows normal. Not sure what is causing the '0'.
I will try to experiment with styling, see if this will fix my issue. I'll update here.
Thank you!
weird.. I ran the code you gave.. Normal Style works but not on the 2nd line(Right Bold) I tried to style both lines with normal but 2nd line still shows '0' on the last next line.
I'm thinking here: it is one possible that your printer is printing zero when you send one cut, it is because on cut(), the driver send ascii 48 '0' and the printer doen't recognize the cut command (GS V command).
thest the code without cut...
PrintService printService = PrinterOutputStream.getPrintServiceByName("tm-t20-usb" );
PrinterOutputStream printerOutputStream = new PrinterOutputStream(printService);
EscPos escpos = new EscPos(printerOutputStream);
// escpos.writeLF("Test Test Test Test Test");
// escpos.write("Test Test Test Test Test");
PrintModeStyle normal = new PrintModeStyle();
escpos.writeLF(normal,"hello normal PrintModeStyle");
PrintModeStyle rightBold = new PrintModeStyle().setBold(true).setJustification(EscPosConst.Justification.Right);
escpos.writeLF(rightBold,"Right bold");
// change this line
// escpos.feed(5).cut(EscPos.CutMode.FULL);
// by this
escpos.feed(15);
escpos.close();
even feed(15);
also gives me zero but I was able to fix it by using escape escpos.writeLF(normal,"\n\n\n");
instead.
PrintModeStyles works perfectly! Thank you very much @anastaciocintra!
good @wellnotanaccount count on me. if you discover wich sequence is the cut on your printer send here.
When printing using using writeLF(), '0' shows only at the beginning of the line and using write() it adds '0' at the start and end of the line. Any idea how to fix this?
When trying to System out it shows this