All I'm really trying to accomplish is to override print settings in IE using a COM DLL and the templateprinter object. The ATL COM DLL is pre-built in an example written by MS, but I just can't get the page orientation to work. Any help would be appreciated.

The Microsoft sample project and code is located at:

http://msdn.microsoft.com/downloads...ine/default.asp

Everything works okay except for printer orientation.

My code in the PT.htm file is as follows:


<!--TOOLBAR_START--><!--TOOLBAR_EXEMPT--><!--TOOLBAR_END-->
<HTML XMLNS:IE>
<HEAD>
<?IMPORT NAMESPACE="IE" IMPLEMENTATION="#default">
<SCRIPT LANGUAGE="JavaScript">

function Init()
{
/*
alert(printer.PageWidth);
alert(printer.PageHeight);
alert(printer.marginTop);
alert(printer.marginBottom);
alert(printer.marginLeft);
alert(printer.marginRight);
*/
window.dialogWidth = "0px";
window.dialogHeight = "0px";

printer.marginRight = 50;
printer.marginLeft = 50;
printer.marginTop = 50;
printer.marginBottom = 50;
printer.orientation = "portrait";
oInterval = window.setInterval("fnRecycle()",100);
printer.showPageSetupDialog();
Done();
}

function Done()
{
window.close();
}

var oInterval = "";
var icounter = 0;

function fnRecycle()
{
icounter += 1;
if(icounter > 30)
{
window.clearInterval();
}
}



</SCRIPT>
</HEAD>

<BODY ONLOAD="Init()" SCROLL="no" style="width:8.5in; height:11.0in">
<IE:TEMPLATEPRINTER ID="printer"/>

</body>
</html>