How to print a web page

It is very easy and one or two step process to print the web page. Printing of web page can be done in two ways.

Method 1:  Print the whole web page using the print button.
Step 1: Write the code given below where you want to add the print button

<input type="button" value="Print" onclick="window.print();">
This will print the whole web page which contains the button.

Step 2: Print the other page, specially designed for printing.

Step 1 : Make two pages of the same content, first for web display and second for printing.

Step 2 : On first web page write the code below to add the print button.

<input type="button" value="Print" onclick="window.open('YourPrintPage.aspx')"/>
Step 3 : Add the given script to the end of the second page.

<script language="javascript" >
window.print();

</script>

But, Printing of web page depends on many things, like Different web browsers,
Operating systems, CSS Styles etc.

So, Using PDF format’s is better than making two different files. Because PDF’s
are platform independent.

Search This Blog

Link Within Related Posts Plugin for WordPress, Blogger...