Click to See Complete Forum and Search --> : Programming a Print Button


daneb
August 4th, 2000, 03:57 AM
Good day!

I have a page that has a button, captioned "Print Page", that when clicked, will print the entire current page. Instead of using the Print command from the File menu of the browser, the user's requirement is to use this button. The page shows a report in tabular format. Do you have any ideas how to program this button? Thanks in advance!

sushmita.dutta
March 3rd, 2005, 05:37 AM
its very simple.
you have to write the code in javascript.
set onclick attribute for that button like the following example

cmdPrint.Attributes("onClick") = "javascript:printFunc()"

and now write this function in javascript

printFunc()
{
window.print();
}

anupam kant
March 6th, 2005, 11:22 PM
Sushmita,
Is there any work around to avoid print dialog. I mean to select default printer of the client machine.

cmiskow
March 7th, 2005, 02:37 PM
If your client uses MSIE exclusively, you might be able to do this with a client-side activex control or some other microsoft technology. Aside from this there is no way... it would be a massive security issue.