Epson TM-U220 ePOS-Print XML Users Manual - Page 56
Checking the Printer Status, To check the printer status without printing, send empty print data.
View all Epson TM-U220 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 56 highlights
Chapter 3 Programming Guide Checking the Printer Status To check the printer status without printing, send empty print data. Refer to the following program. //Set the end point address var url = 'http://192.168.192.168/cgi-bin/epos/ service.cgi?devid=local_printer&timeout=10000'; //Create an empty print document to check the printer status var soap = ' '; //Create an XMLHttpRequest object var xhr = new XMLHttpRequest(); // xhr.open('POST', url, true); // xhr.setRequestHeader('Content-Type', 'text/xml; charset=utf-8'); xhr.setRequestHeader('If-Modified-Since', 'Thu, 01 Jan 1970 00:00:00 GMT'); xhr.setRequestHeader('SOAPAction', '""'); //Set a response reception callback function for checking xhr.onreadystatechange = function () { if (xhr.readyState == 4){ if (xhr.status == 200){ var res = xhr.responseXML; var success = res.getElementsByTagName('response')[0].getAttribute('success'); if (!/^(1|true)$/.test(success)) { alert('Success Send empty print data xhr.send(soap); 56