# Verify Printer Paper Status

* **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.

* When print receipt, sometime app want to know whether the receipt has finished printing, it can call this method to check too, because the printer commands are executed sequentially.

{% code overflow="wrap" lineNumbers="true" %}

```java
  device = (PrinterDevice) POSTerminal.getInstance(mContext).getDevice(POSTerminal.DEVICE_NAME_PRINTER);
  int result = device.queryStatus();
  device.close();
```

{% endcode %}

* **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.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://smartpossdk.gitbook.io/cloudpossdk/faq/printer/verify-printer-paper-status.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
