[Download Code]
Why would you want to print a web form directly to a printer once the user submits it? Consider that not everyone in an organization has access to the same level of technology. Usually web form data is sent via email, saved as a text or xml file, or added to a database. For many applications the email option works well. But, in some organizations this email is then printed so that someone else can take the necessary action. This works well where management desires to approve all events. If the web form is printed to a network printer instead of or in addition to the email being sent; then the person responsible for taking action has access to the information. The rest of this discussion will focus on printing a web form.
Note: This article uses server-side code to print a web form to a printer that is installed on the server. Client-side code would be required to print a web page to a printer that is installed on the client. Using client-side javascript you can bring up the print dialog box with this statement: window.print();.