Page 1 of 1

Printing with precise margin settings

Posted: Tue Sep 15, 2009 10:12 pm
by Gian
The file "sample.php" is part of a large program to enable printing on a frame with precise margin settings.
The object enabling this is provided by the British Company MeadCo.
The printing is allowed only when the user does NOT change the value in the input box (flag=false).
1) Unfortunately the enclosed coding does not work, in the frame I only get the value of the variable "box", but I do not get the value of the variable "flag".
2) In order to apply an automatic correction to the printer, the variables "deltaleft" and "deltatop" are to be available in the frame, howevere I do not get their values printed in the frame (I am looking for the right coding to pass these two variables from "sample.php" into the frame source "pop.html").
I would like anyone helping in telling what the fault is and which would be the right code, THANK YOU !
I enclose the following coding :
FILE sample.php :
<html>
<head>
<script>

function flag()
{ flag=true; }

function doIt()
{
if (!flag)
{
factory.printing.portrait = true;
factory.printing.rightMargin = .25;
factory.printing.header = "";
factory.printing.footer = "";

factory.printing.leftMargin = .25;
var marleft=factory.printing.leftMargin;
deltaleft = 25.4 * (marleft-.25);

factory.printing.topMargin = .1 ;
var martop=factory.printing.topMargin;
deltatop = 25.4 * (martop-.1);

fr1.focus();
factory.printing.Print(true,fr1);
}
}

</script>
</head>
<body>

<!-- MeadCo smsx -->
<object id='factory' viewastext style='display:none'
classid='clsid:1663ed61-23eb-11d2-b92f-008048fdd814'
codebase='smsx.cab#Version=6,5,439,12'>
</object>

<form name="inputform" action="sample.php" method="post">
<?
$box++;
echo "<input type='text' name='box' onchange='flag()' value='$box' >" ;
?>
<input type='submit' onclick='doIt()'>
</form>

<iframe name="fr1" id="fr1" src="pop.html"></iframe>

</body>
</html>

FILE pop.html :
<html>
<body>
<script>

box = parent.document.inputform.box.value;
document.write("box = "+box);

flag = parent.document.inputform.flag.value;
document.write("flag = "+flag);

deltaleft = parent.document.inputform.deltaleft.value;
document.write ("deltaleft = "+deltaleft);

deltatop = parent.document.inputform.deltatop.value;
document.write ("deltatop = "+deltatop);

</script>
</body>
</html>