Tuesday, May 27, 2008

Print Dynamic Pages Using JavaScripts

Print specific part of the web page become very handy when you want to keep the layout of the website in the printer friendly web page as well. For example you might not want to remove the navigation. This technique can be useful to print Dynamic web pages.
First you have to select the area you want to print. Mark the selected area using “div” html tag. Do not forget to specify the DIV tag as well using id attribute.


Tip: 1. Do not forget to specify the width of the print area to 595 as it is the best width for A4 size paper.2. You are free to use any CSS as you can change it when it sends to the printer. However, it is safe and clear to use the same CSS as reader can have clear idea about how it will looks like when it print.
Now we should get the help of JavaScript to do the printing.

Click here for full sample code : javasript print example
Blog Widget by LinkWithin