Getting printer status with Browser Print api

// Expert user has replied.
T Tuncay Bahadır 1 year 4 months ago
52 1 0

With my gk 420 printer, I cannot get the printer status via the browser with the BrowserPrint-3.1.250 version api file. Is the cover open, like there is an error in the printer. It is mentioned in the status section of the API document, but I was not successful in accessing it. Also, printer statuses appear in BrowserPrint-Zebra-1.1.250 js file, but how do I use it? The documentation is not for beginners, but for those who already know the product.

Please Register or Login to post a reply

1 Replies

S Steven Si

The printer status is in the Zebra module of the JavaScript library. You can use the index.html in the Sample folder as a base to add the printer status. Include the BrowserPrint-Zebra-1.1.250.min.js library in the index.html as shown below.

<script type="text/javascript" src="BrowserPrint-Zebra-1.1.250.min.js"></script>

Add the following function for status checking.

// The printer is already identified by the selected_device object in the index.html.
var checkPrinterStatus = function() {
    var printer = new Zebra.Printer(selected_device);
    var status = printer.getStatus(success, failure);
}
var success = function(status) {
    var statusMsg = status.getMessage();
    var isReady = status.isPrinterReady();
    alert("statusMsg: " + statusMsg +"\nisReady: " + isReady);
}
var failure = function(status) {
    alert("Got a failure");
}

 

CONTACT
Can’t find what you’re looking for?