Click here to Skip to main content
15,886,519 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
We have a ASP.net page with 4 textboxes and data saved in textboxes. I want to create a button which will result into a pop-up showing three controls:

1. Dropdown showing list of Printers ( Selected printer should be used for printing purpose)
2. Showing number of copies to be printed. (Mention number of copies).
3. Print button (Which will actually print pages on selected printer from dropdown with number of copies configured in 2nd control i.e. text box)

Is there any way to do this using .net 3.5 version ???


Thanks in advance.
Posted
Comments
Have you tried anything yet?

1 solution

With ASP.NET...

1. You cannot get a list of installed client printers. ASP.NET is a server side framework that cannot access client machine. To get a list of installed printers at the client side you need an external tool based on some client tech like ActiveX, Flash, Silverlight, others....

2. No problem with this...

3. Printing through classic javascript window.print() is not "configurable" i.e. you cannot specify printer name, copies, etc.

By the way... what kind of file do you need to print? pdf? doc? the content page in html format? what?
 
Share this answer
 
Comments
deepakdynamite 30-Jan-14 7:17am    
Thanks for response.
First thing, I will not fetch list of Printers.. as per requirement I will hard code name of shared printers in Dropdown.

I won't be using window.print() as i know we cannot manipulate anything in that control through application. Instead I want c# code which actually prints document. And atlast i want to print a web page but requirement is to intergrate Window.print functionality within Web application i.e. setting number of copies
Marc Gabrie 30-Jan-14 21:06pm    
The main problem is... you cannot use C# to print to the client printer in an ASP.NET scenario. The C# code you write in your website is executed in the web server where you host your site not on the client machine.
deepakdynamite 30-Jan-14 23:32pm    
Hi Marc,

My server and client both belong to close network i.e. If code is executed on server, Server will have access to all shared printers same as client. My application won't be available on world wide web. we are developing it for an organization where employees will use this application.
Marc Gabrie 1-Feb-14 6:17am    
That is a very different scenario then. Anyway, to get a lis of installer printers from your "internal website", you should develop a Windows Service project that could list the printers installed on the machine where it will run by using this code http://msdn.microsoft.com/en-us/library/system.drawing.printing.printersettings.installedprinters(v=vs.110).aspx

Your Windows Service should be the listener in a TCP Client/Server model (http://www.codeproject.com/Articles/1415/Introduction-to-TCP-client-server-in-C). Then your code at the server should connect to that listener on the client and get the installed printer from it.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900