anastaciocintra / escpos-coffee

Java library for ESC/POS printer
https://anastaciocintra.github.io/escpos-coffee
MIT License
277 stars 72 forks source link

Strange behavioue #82

Open sKY02644 opened 2 years ago

sKY02644 commented 2 years ago

Steps to Reproduce

just strange behaviour

  1. ... No idea how to as it might it working on all other machines just one

Evidences

SO EVERY THING IS WORKING FINE EVEN AFTER BUILD FOR PRODUCTION BUT THERE IS ONE MACHINE THAT SHOWS PRINTING THE DOCUMENT BUT THE DOCUMENT IS NEVER PRINTED AND NO ERRORS ARE SHOWN TO.

PLEASE ASSIST ME DEBUG IM KINDA CONFUSED

sKY02644 commented 2 years ago

I TRIED THE PRINTER FROM A DIFFERENT MACHINE AND IT PRINTED SO THE PRINTER IS NOT FAULTY

I ALSO TRIED TO USE THE SAME JAVA VERSION GOT THE SAME BEHAVIOUR

IM REALY CONFUSED

sKY02644 commented 2 years ago

I JUST NOTICED ANOTHER MACHINE IS HAVING THE SAME PROBLEM NO ERRORS DOCUMENT IS BEEN SENT TO PRINTER BUT ITS NOT PRINTING

anastaciocintra commented 2 years ago

Hi @sKY02644 , We have some clues.

If you are not using PrinterOutputStream, disregard the answer!

Ok, if are you using PrinterOutputStream, it can be reproduced by installing one printer on system (with no real printer connected to it)

How to reproduce: In my ubuntu machine, I have one good and real printer installed (TM-T20), and other fake printer (CUPS-BRF-Printer) as you can see on screenshot.

Both printers is listed on PrinterOutputStream.getListPrintServicesNames(), and can be used as "printer name" without error, but only TM-T20 send content to the printer!

java -jar getstart-4.1.0-jar-with-dependencies.jar 
Usage: java -jar getstart.jar ("printer name")
Printer list to use:
CUPS-BRF-Printer
TM-T20

Solution If it is your case, the solution is simple: just ensure that the printer is correctly installed on the system.

Screenshot from 2022-08-16 10-04-52

sKY02644 commented 2 years ago

@anastaciocintra THANK YOU FOR THE QUICK REPLY

PrintService printService = PrinterOutputStream.getDefaultPrintService();

I AM ACTUALLY USING THE PrinterOutputStream AND THE PRINTERS ARE XPRINTER PRINTERS THE PRINTERS ARE INSTALLED CORRECTLY

sKY02644 commented 2 years ago

THE APPLICATION HANGS AWAITING FOR THE PRINTING TO COMPLETE BEFORE IT CONTINUES AND SINCE THE COMMAND IS SENT TO THE PRINTER BUT ITS NOT PRINTED

ALSO THE MACHINES PRITING , I JUST NOTICED ARE THE MACHINES WE USE FOR DEVELOPMENT WHEN WETEST THE PRODUCTION VERSION ON OTHER MACHINES IT SENDS COMMAND TO PRINTER AND SHOWS PRINTING STATUS BUT NEVER PRINTS

anastaciocintra commented 2 years ago

@sKY02644 , I could be wrong, and that we have a bug in the lib, but, In my humble opinion, you have environment differences, something like:

sKY02644 commented 2 years ago
  1. ALL THE PRINTERS WHERE TESTED WITH THE SAME DRIVERS ON A WORKING MACHINE AND ALL WORKED

QUICK SIDE NOTE WE ARE CALLING THE JAR FILE FROM AN ELECTRON APP WHICH WE USING THE java-caller MODULE TO CALL THE JAR FILE

ALL JAVA VERSIONS ARE THE SAME ACROSS ALL THE MACHINES

THIS JAR FILE READS A .JONS FILE WHICH IT DOES AND GENERATES THE RECEIPTE AND SENDS IT TO THE DEFAULT PRINTER