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?
CodePudding user response:
It is a known issue AFAIK. You probably need to try printing something first and then check the status.