The most important thing to understand doing any type of web development is the concept of Server-Side-Code and Client-Side-Code.
Server side code is executed on a web server. It dynamically generates HTML (and maybe JavaScript) that is sent to the browser so that the browser can display information to the user.
The client side code is any code that is displayed in the browser. It is the HTML and JavaScript that the browser is using to display data to the user.
Any C# or VB.NET code that you have as part of your ASP.NET application is executed on the server. So, if you use the
System.Drawing.Printing
namespace in your C# or VB.NET code, it will attempt to connect to a printer on the server to print something. That means that the web server has to be connected to the printer and that your ASP.NET application has to be running under an account that has permissions to access the printer. It also means that, if the printing was successful, the person using your web application will not see the print out (since it physically printed off a printer attached to the web server).
If you want the end user to be able to print something, then you need to use client-side code to achieve this. JavaScript is a client side scripting language that lets you run code (like printing) in the browser.
So, I recommend you look into using the
JavaScript print() method and also look into creating a
printing style sheet so that content prints in a printer friendly way... in the way you want it to print.... on the end user's printer.
-Frinny