Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C# Network Printing

I am able to get the list of network printers via this code:

private void Form1_Load(object sender, EventArgs e)
{
  foreach (String printer in PrinterSettings.InstalledPrinters)
  {
    listBox1.Items.Add(printer.ToString());
  }
}

For each network printer, I want to extract out more information like: (a) get document information, like number of pages printed, filename, file-size, etc.

(b) get computer IP address from which document was printed.

(c) get username of who printed the document.

How do I achieve the above? any code samples would be appreciated. Do I have to look into Windows Management Instrumentation(WMI) stuffs?

like image 765
user314275 Avatar asked Nov 15 '22 11:11

user314275


1 Answers

You might be able to get out some of the information via WMI:

http://msdn.microsoft.com/en-us/library/Aa394363

If you want more information, and your printers support it, you might be able to use SNMP, here's an article\library that might help you find out how to use that:

http://www.codeproject.com/KB/cs/SNMPDLL.aspx

like image 184
Hans Olsson Avatar answered Dec 24 '22 05:12

Hans Olsson