Jump to content


Photo

Create Print Preview Button


  • Please log in to reply
1 reply to this topic

#1 lilywong

lilywong
  • Members
  • PipPipPip
  • Advanced Member
  • 56 posts

Posted 22 March 2006 - 01:13 AM

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();">

#2 hitman6003

hitman6003
  • Members
  • PipPipPip
  • Advanced Member
  • 1,807 posts

Posted 22 March 2006 - 02:16 AM

After approximatly 30 seconds of searching on google I found this IE only solution:

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 = “”;
}

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.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users