Print Preview

Javascript coding ..

Moderators: macek, egami, gesf

kiwi
New php-forum User
New php-forum User
Posts: 124
Joined: Sun Feb 29, 2004 6:26 am
Contact:

Print Preview

Postby kiwi » Mon Oct 05, 2009 8:07 am

what are the script use to control the screen setting in the IE print preview,

here is the code for the print preview, but i need to set it when the page for the print preview load, it auto set the print size to 100%, the paper to vertical or portrait and etc. Any one try this before, thanks

<script>
function printpreview()
{
var OLECMDID = 7;
/* OLECMDID values:
* 6 - print
* 7 - print preview
* 1 - open window
* 4 - Save As
*/
var PROMPT = 1; // 2 DONTPROMPTUSER
var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';
document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
WebBrowser1.ExecWB(OLECMDID, PROMPT);
WebBrowser1.outerHTML = "";
}
</script>

Return to “JavaScript”

Who is online

Users browsing this forum: No registered users and 2 guests

cron