October 23, 2006

Printer Friendly Pages using Javascript

I found a really good article "Dynamically Create Printer Friendly Pages" by By Robbe D. Morris.

But I have a one addition to their scripts so that Print dialog will open automatically. For example calling the following line after their GetPrintContent() function, will open a Print Dialog.

window.setTimeout('window.print()', 1000);

Here we wait for a second so that the printable content is displayed in browser.

No comments: