How to Verify Printer Status: Out of Paper Check

From wizarPOS
Revision as of 19:35, 23 December 2023 by Simon (talk | contribs)

Java API: Using queryStatus() to Check Paper Availability in Printer

  • Purpose of queryStatus():

This method is used to ascertain the paper status in the printer. It is especially useful for checking if paper is available before initiating a print job. In cases of printing large receipts, it may be advisable to check the paper status after printing as well..

  device = (PrinterDevice) POSTerminal.getInstance(mContext).getDevice(POSTerminal.DEVICE_NAME_PRINTER);
  int result = device.queryStatus();
  device.close();
  • Understanding the Result Codes:
    • Result < 0: Indicates an error. The specific negative value corresponds to a particular error code.
    • Result = 0: Signifies that the printer is out of paper.
    • Result = 1: Confirms that the printer has paper available for printing.