3

I have EPSON thermal printer, model TM-88IV. I am able to get the various properties of the printer but cannot find any to get the following status:

  1. Paper is out
  2. Printer is in error state
  3. Printer is off

I am using the following code:

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
        );
}

I am getting various values for the above properties but cannot map it to the status of the printer.

The output is

Name: EPSON TM-T88IV
PrinterStatus : 3
DetectedErrorState: 0
ExtendedDetectedErrorState: 0
ExtendedPrinterStatus: 2 

I have installed the EPSON TM-88IV drivers that came in the cd along with the printer.

Jan Doggen
  • 8,799
  • 13
  • 70
  • 144
HotTester
  • 5,620
  • 15
  • 63
  • 97

1 Answers1

2

Apparently DetectedErrorState and ExtendedDetectedErrorState show 0 which means Unknown. Does that mean this printer doesn't support this property, your current driver doesn't support it, or something else - I don't know. Also your ExtendedPrinterStatus shows 2 which means Unknown.

Your PrinterStatus says 3 which means Idle so you can't gather any useful information from this.

Try querying for PrinterState. It is a long shot though because this property is marked obsolete, but hey, it's just a line of code, see what would it return.

More info about what each returned value means is found here

EDIT
As this printer should support automatic status back (ASB) notification, you might be able to read that status directly from the printer, not using WMI. Refer to this SO question for details about ASB. Here is the specification for your printer

Community
  • 1
  • 1
Dejan Janjušević
  • 3,181
  • 4
  • 41
  • 67