Getting print job status using BrowserPrint's JavaScript API

// Expert user has replied.
R Rio Sevilla 9 months 2 weeks ago
314 1 0

We have a web application written in React that uses an ES wrapper of the BrowserPrint API here https://github.com/brianzinn/browserprint-es. Our objective is to get a running print job's status but there are no methods in BrowserPrint's documentation that seem to achieve this. Currently, we are only able to get the printer's status using the getStatus method from the Printer class. We have also tried checking finishedCallback and errorCallback from the send method, but after doing a test print with insufficient paper, we are unable to get a "media out" response from the errorCallback and only finishedCallback is called.

Any help would be greatly appreciated.

Please Register or Login to post a reply

1 Replies

S Steven Si

The Browser Print JavaScript API communicates with the mini webserver created by the Browser Print local client app on the device. The callbacks from the send() method only indicate whether the HTTP request being sent out successfully to the mini webserver or not. The Browser Print doesn't have the ability to notify the caller whether the print job is completed or not. Therefore, we cannot monitor the print job status at runtime. It's recommended to check the printer status with the getStatus() prior to sending out any print job each time, so that we only send out a print job when the printer is ready to print. The insufficient paper will be detected after the getStatus() is called again.

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