I have a web application with asp.net 2.0 and I want to create a dropdown menu showing the printers installed on the client machine? How is that possible?
I tried the following code
foreach (string strPrinter in System.Drawing.Printing.PrinterSettings.InstalledPrinters)
{
// add to list
}
but it shows only the local printers attached with the server, not the client machine.
You can’t get it in ASP.NET because that’s running on your server. You can’t get it in Javascript either. It’s just not available; see, for example, http://javascript.about.com/od/events/a/print_3.htm.
The only solution I can think of is to build an ActiveX control, and you then you could use the C# you have in the question, except running on the client. Of course, that limits you to IE.