-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
it only prints the first time i execute the code #54
Comments
once i do the escpos.close(); it does not print anymore. |
Hi @palanganero one simple way to code it is: EscPos escpos = new EscPos(new PrinterOutputStream(printService));
// send data to the printer
escpos.close();
// again!
escpos = new EscPos(new PrinterOutputStream(printService));
// send data to the printer
escpos.close();
// and again!
escpos = new EscPos(new PrinterOutputStream(printService));
// send data to the printer
escpos.close(); |
with this code it only prints "hola holita":
|
the main problem i have is that when i print a ticket (after doing escpos.close()) i have to reboot the printer. It happens to me only in linux in usb mode (in ethernet mode works fine). In windows works fine. What can i try? |
wow! have multiple configurations. are you using implementations from the lib?
|
i have ubuntu with PrinterOutputStream. it should be ok. |
@palanganero I don't know why. but if you write a line with feed and cut. it work fine.. escpos.writeLF("Hello Wold");
escpos.feed(3).cut(EscPos.CutMode.FULL);
escpos.close();
escpos = new EscPos(new PrinterOutputStream(printService));
escpos.writeLF("Hola holita");
escpos.feed(3).cut(EscPos.CutMode.FULL);
escpos.close();
escpos = new EscPos(new PrinterOutputStream(printService));
escpos.writeLF("Hola que tal");
escpos.feed(7).cut(EscPos.CutMode.FULL);
escpos.close(); |
my problem is that only prints the first time i execute the program. If i run the program again it doesn't print. If i unplug the usb cable and plug it again it prints again. But only one time. I tryed with several drivers and keeps the same. It seems to be a usb problem because if i connect the printer by ethernet it doesn't have problem. When i reboot the system it prints again. |
Maybe some kind of driver configuration |
yes only in linux and by ethernet is not problem. |
Tomorrow |
hi @palanganero My environment is ubuntu/openjdk 11 with generic Text Only printer installed.
and, really, the code print somethig unexpected... but if you print with one readline (enter keyboard) between print blocks it will be ok (I don't know why) another thing is that I'm sending four lines with feed and cut (like a complete receipt) and not only one line.. Scanner keyboard = new Scanner(System.in);
PrintService printService = PrinterOutputStream.getPrintServiceByName("TM-T20");
escpos = new EscPos(new PrinterOutputStream(printService));
escpos.writeLF("Hello Wold");
escpos.writeLF("Hello Wold");
escpos.writeLF("Hello Wold");
escpos.writeLF("Hello Wold");
escpos.feed(5).cut(EscPos.CutMode.FULL);
escpos.close();
keyboard.nextLine();
escpos = new EscPos(new PrinterOutputStream(printService));
escpos.writeLF("2Hello Wold");
escpos.writeLF("2Hello Wold");
escpos.writeLF("2Hello Wold");
escpos.writeLF("2Hello Wold");
escpos.feed(5).cut(EscPos.CutMode.FULL);
escpos.close();
keyboard.nextLine();
escpos = new EscPos(new PrinterOutputStream(printService));
escpos.writeLF("3Hello Wold");
escpos.writeLF("3Hello Wold");
escpos.writeLF("3Hello Wold");
escpos.writeLF("3Hello Wold");
escpos.feed(5).cut(EscPos.CutMode.FULL);
escpos.close();
// keyboard.nextLine();
} catch (IOException e) {
e.printStackTrace();
} On real world app, like server print or swing app it works well see you |
ok, thank you, it should be some kind of incompatibility with the drivers. |
i have to power off and power on again to do a new print.
The text was updated successfully, but these errors were encountered: