Jump to content

Archived

This topic is now archived and is closed to further replies.

lilywong

Create Print Preview Button

Recommended Posts

to print, we can use the following javascript code, but how if i want to create a print preview button, is there anyway ? thanks.

<input type="Button" name="printit" value="print" onclick="javascript:window.print();">

Share this post


Link to post
Share on other sites
After approximatly 30 seconds of searching on google I found this IE only solution:

[code]function printpr()
{
var OLECMDID = 7;
/* OLECMDID values:
* 6 - print
* 7 - print preview
* 1 - open window
* 4 - Save As
*/
var PROMPT = 1; // 2 DONTPROMPTUSER
var WebBrowser = ”;
document.body.insertAdjacentHTML(‘beforeEnd’, WebBrowser);
WebBrowser1.ExecWB(OLECMDID, PROMPT);
WebBrowser1.outerHTML = “”;
}[/code]

which came from this website:

[a href=\"http://www.magpiebrain.com/archives/2004/05/14/livecomments#comment1392\" target=\"_blank\"]http://www.magpiebrain.com/archives/2004/0...nts#comment1392[/a]

I can't take credit for the script, nor can I verify that it works. Google is your friend.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.