How to Verify Printer Status: Out of Paper Check: Difference between revisions
(Created page with "== Java API: queryStatus() == Generally, call this method to check whether paper existed before one time printing, if print a large receipt, perhaps need check after printing....") |
No edit summary |
||
Line 1: | Line 1: | ||
== Java API: queryStatus() == | == 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.. | |||
<syntaxhighlight lang="java" line='line'> | <syntaxhighlight lang="java" line='line'> | ||
device = (PrinterDevice) POSTerminal.getInstance(mContext).getDevice(POSTerminal.DEVICE_NAME_PRINTER); | device = (PrinterDevice) POSTerminal.getInstance(mContext).getDevice(POSTerminal.DEVICE_NAME_PRINTER); | ||
Line 7: | Line 8: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
* '''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. | |||
Revision as of 19:35, 23 December 2023
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.