Re: Server Printing using Print Dialog
- From: BrassicaNigra <brassica_nigra@xxxxxxxxxxxxxxxx>
- Date: Wed, 9 Jul 2008 07:39:02 -0700
Mark,
This looks just like what I need, however when I used the code snippet I
received an error that System.Management namespace does not exist. Is there
something else I need to include?
Dale
"Mark Rae [MVP]" wrote:
"BrassicaNigra" <brassica_nigra@xxxxxxxxxxxxxxxx> wrote in message.
news:CB9AC21E-765C-4906-987D-E4155BD72B4D@xxxxxxxxxxxxxxxx
How can I bring up a print dialog box in the client browser that offers
the
different printers available to the server?
You can't. Calling a dialog box on the server would pop a dialog box on the
server - there will be no-one there to see it...
If that is not possible, is there a way to retrieve the names of the
printers on the server. I could then use the PrintSettings.PrinterName
property to set the output myself
Certainly. Because the code will be running on the server, you have the
entire .NET Framework at your disposal. There are several ways you can
retrieve the collection of printers installed on the server, but WMI is
probably the simplest:
using System.Collections.Generic;
using System.Management;
using (ManagementObjectSearcher objMOS = new
ManagementObjectSearcher("SELECT * FROM Win32_Printer"))
{
using (ManagementObjectCollection objMOC = objMOS.Get())
{
foreach (ManagementObject objMO in objMOC)
{
// do something with objMO["Name"]
}
}
}
--
Mark Rae
ASP.NET MVP
http://www.markrae.net
- References:
- Re: Server Printing using Print Dialog
- From: Mark Rae [MVP]
- Re: Server Printing using Print Dialog
- Prev by Date: dropdownlist problem
- Next by Date: Re: Cannot load my custom HttpHandler
- Previous by thread: Re: Server Printing using Print Dialog
- Next by thread: Re: Server Printing using Print Dialog
- Index(es):
Relevant Pages
|