我有 EPSON 热敏打印机,型号 TM-88IV。我能够获得打印机的各种属性,但找不到任何获得以下状态:
- 纸没了
- 打印机处于错误状态
- 打印机关闭
我正在使用以下代码:
string printerName = "EPSON";
string query = string.Format("SELECT * from Win32_Printer WHERE Name LIKE '%{0}%'", printerName);
ManagementObjectSearcher searcher = new ManagementObjectSearcher(query);
ManagementObjectCollection coll = searcher.Get();
foreach (ManagementObject printer in coll)
{
MessageBox.Show(printer.Properties["Name"].Name + " - " + printer.Properties["Name"].Value
+ "\n" +
printer.Properties["PrinterStatus"].Name + " - " + printer.Properties["PrinterStatus"].Value
+ "\n" +
printer.Properties["DetectedErrorState"].Name + " - " + printer.Properties["DetectedErrorState"].Value
+ "\n" +
printer.Properties["ExtendedDetectedErrorState"].Name + " - " + printer.Properties["ExtendedDetectedErrorState"].Value
+ "\n" +
printer.Properties["ExtendedPrinterStatus"].Name + " - " + printer.Properties["ExtendedPrinterStatus"].Value
);
}
我得到了上述属性的各种值,但无法将其映射到打印机的状态。
输出是
Name: EPSON TM-T88IV
PrinterStatus : 3
DetectedErrorState: 0
ExtendedDetectedErrorState: 0
ExtendedPrinterStatus: 2
我已经安装了随打印机一起提供的 CD 中的 EPSON TM-88IV 驱动程序。