How to Print Part of a Web Page [Code]

The following  JavaScript code enables you to print part of or a specific section of a web page. I found this very useful code at About.com, just follow the instructions in the link and you should be fine.

By using this code you can allow users to print only specific areas of a web page like ‘coupons’ or ‘business cards’ on an ecommerce site rather than printing the whole webpage. For instance, in the following page, only the dotted area is printed upon clicking ‘print this page’ at the bottom of the page.

print-part-of-a-webpageAlternatively, if you would like to print the entire webpage, you ca paste the following code between the <body> and </body> section of your webpage:

<a href=”javascript:print(document)”>print this page</a>

You might want to go through a useful tutorial on how to print part of a web page using  jQuery. You can do download the code snippet to print parts of a web page using jQuery here.