Question

I am trying to get the printer status of a PointOfSale printer using the following code:

Hashtable properties = new Hashtable();
ManagementObjectSearcher searcher = new ManagementObjectSearcher("SELECT * FROM Win2_Printer");

foreach (ManagementObject obj in searcher.Get()) {
  if (obj["name"].ToString() == printerName) {
    foreach (PropertyData data in obj.Properties) {
      if(data.Name.ToLower() = "printerstatus") {
        int printerStatus = Convert.ToInt32(data.Value);
      }
    }
  }
}

Problem is, the status is either 3 (idle) or 4(printing), even when unplugged or the paper is out.

I have read a lot of posts with this same issue, but have not found an answer. Is this correct? How else would I check the status? Any help is appreciated.

Was it helpful?

Solution

What Brand of printer are you using?

Sometimes the Brand will have a specific command you can send to query the status.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top