Hello, I have this code to restore printer properties:
string printerName = "PrinterName"; 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) { foreach (PropertyData property in printer.Properties) { Console.WriteLine(string.Format("{0}: {1}", property.Name, property.Value)); } }
But properties always need to return the same:
PrinterState: 0
PrinterStatus: 3
Basically, I need this to check if the printer has paper. I would think: PrinterState: 4
Tested on wxp-86 and w7-64, return the same, .Net 4.0
Thank.
Alexx Perez Jan 22 '13 at 10:07 2013-01-22 10:07
source share