Re: Server Printing using Print Dialog
- From: stcheng@xxxxxxxxxxxxxxxxxxxx (Steven Cheng [MSFT])
- Date: Wed, 09 Jul 2008 03:19:04 GMT
Thanks for Mark's great inputs.
Hi Dale,
I agree with Mark that it is not allowed to display server-side printer
setting interface to web application's client user(different machine or
network boundary). The reasonable approach is use a web page to offer the
user interface for the client user to choose the printer. You can first
queries all the printers installed on the server machine and display in
webpage to let the user choose one.
Mark has also posted some good code snippet of using WMI to query the
printers on the machine.
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
msdnmg@xxxxxxxxxxxxxx
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
From: "Mark Rae [MVP]" <mark@xxxxxxxxxxxxxxxxx>
References: <CB9AC21E-765C-4906-987D-E4155BD72B4D@xxxxxxxxxxxxx>
In-Reply-To: <CB9AC21E-765C-4906-987D-E4155BD72B4D@xxxxxxxxxxxxx>
Subject: Re: Server Printing using Print Dialog
Date: Wed, 9 Jul 2008 00:34:48 +0100
the
"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
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: RE: solution Re: Gridview: embedding a texbox and button in each row, passing info from that row to a function?
- Next by Date: Re: Notifying a user on demand
- Previous by thread: Re: Server Printing using Print Dialog
- Next by thread: Re: Server Printing using Print Dialog
- Index(es):