1

I want to check if the printer has a paper or not, for this I use WMI to pick up the printer and use PrinterStatus, the problem is that it always returns 0 ("Unknow"), and I don't understand the reason, my code is as follows:

public int ImpresoraStatus()
{
    var printerQuery = new ManagementObjectSearcher("SELECT * from Win32_Printer WHERE Name = \"KPOS_80 Printer\"");
    foreach (var printer in printerQuery.Get())
    {
        int status = (int)printer["PrinterStatus"];
        return status;
    }

    return 404;
}

Any improvements or something I'm missing?

Selim Yildiz
  • 5,254
  • 6
  • 18
  • 28
Endika
  • 15
  • 3

1 Answers1

1

It is a known issue AFAIK. You probably need to try printing something first and then check the status.

See: Not Able to Monitor Printers' States and Statuses

Selim Yildiz
  • 5,254
  • 6
  • 18
  • 28