user314275
user314275

Reputation: 145

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?

Upvotes: 5

Views: 3021

Answers (1)

Hans Olsson
Hans Olsson

Reputation: 55059

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

Upvotes: 1

Related Questions