Hello there,

I looked all over the internet for a code that allow me to configure the
page size and margins for printing web pages within a script.

I found some CSS tags that were suppose to do that but they didn't work at
all. Later I found a very strange code (sample of the code below) that,
again, was supposed to do that but I get a script error saying "Permission
Denied" while trying to access a printer object.

Can anyone help me?

Thanks,

Thiago

Here is a sample of the weird code:

<HTML XMLNS:IE>
<HEAD>
<?IMPORT NAMESPACE="ie" IMPLEMENTATION="#default">

<SCRIPT LANGUAGE="JavaScript">
function PrintNow() {
var startPage;
var endPage;
var oDeviceRectCollection = document.all.tags("DEVICERECT");

if (dialogArguments.__IE_PrintType == "NoPrompt" ||
printer.selectedPages == false) {
startPage = 1;
endPage = oDeviceRectCollection.length;
} else if (printer.currentPage == true) {
} else {
startPage = printer.pageFrom;
endPage = printer.pageTo;
if (startPage > endPage) {
alert("Error: Start page greater than end page");
return;
}
if (startPage > oDeviceRectCollection.length) {
alert("Error: Start page greater than number of pages in
print job.");
return;
}
if (endPage > oDeviceRectCollection.length) {
alert("Warning: End page greater than number of pages in
print job. Continuing Print Job.");
endPage = oDeviceRectCollection.length;
}
}

printer.startDoc("Printing from Tmplt6.htm");

for (i = startPage - 1; i < endPage; i++)
printer.printPage(oDeviceRectCollection[i]);

printer.stopDoc();
}
</SCRIPT>
<BODY ONLOAD="PrintNow()">

<IE:TEMPLATEPRINTER ID="printer"/>
<IE:HEADERFOOTER ID="headfoot"/>
</BODY>
</HTML>