Click here to Skip to main content
15,887,135 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: (untagged)
how to open print dialog box in asp.net web application using c#?

What I have tried:

how to open print dialog box in asp.net web application using c#?
Posted
Updated 9-May-18 22:14pm

You can't - the C# code runs on the server, not the client, and you don't have direct access to any client hardware.
If you open a print dialog, it will be visible on the server, not the client and will print to server connected printers.
 
Share this answer
 
If you are wanting to enable the web user to print the currently displayed page, try something like
HTML
<input type="button" onclick="window.print();" />


If you want a custom output, create it in a new page (e.g. using
C#
window.open()
) and then include a window.print() in it.

However, please note that you will only get the print options dialog, not the 'select filename' dialog.

Also, note that the print facility may be disabled by group policy or by user preference; in which case, tell them to use the browser menu options.
 
Share this answer
 

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