lilywong Posted March 22, 2006 Share Posted March 22, 2006 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();"> Quote Link to comment https://forums.phpfreaks.com/topic/5464-create-print-preview-button/ Share on other sites More sharing options...
hitman6003 Posted March 22, 2006 Share Posted March 22, 2006 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 DONTPROMPTUSERvar 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. Quote Link to comment https://forums.phpfreaks.com/topic/5464-create-print-preview-button/#findComment-19546 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.