How can I print a web page?

Some browsers support Javascript's Window.Print() method. You can use it in the click event of a control, say a button.

<input type="button" value="Print this window" onClick="Window.Print()"/>

This will bring up a Print Dialog which is good thing since it will allow you make up your mind whether you really want to print; allows you to see if Printer is turned on, etc.

Another way would be to place a Web Browser Control on a windows form. Use the WebBrowser's navigate() method to go to the page you want at form load. Then use the click event of a button to Print.

Ofcourse you need to add a PrintDocument control from Toolbox to your form.

Please Click Here for More Using Server side Printing Technology

No comments: