Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java: get printer status (paper low/out)

Tags:

java

printing

I have printed this way

FileWriter imp = new FileWriter("COM2");
while ((linea = br.readLine()) != null) {
            imp.write(linea);
            imp.write(0x0A);
}

Well now Im using the port COM2, I have a printer that receive a hex code and its response will back in type byte, I dont know how to do it with java. Somebody has done it before?

Thanks.

like image 299
sergio Avatar asked Nov 14 '22 01:11

sergio


1 Answers

You could try using javax.print.attribute.standard.PrinterStateReason

This class is a part of the javax.print.* packages.

like image 77
Gilbert Le Blanc Avatar answered Dec 16 '22 20:12

Gilbert Le Blanc