<head>
<title>打印确认</title>
<style media="print">
.noprint { display: none }
</style>
</head>
<body>
<object id="factory" style="display:none" viewastext classid="clsid:1663ed61-23eb-11d2-b92f-008048fdd814" codebase="http://www.meadroid.com/scriptx/ScriptX.cab#Version=5,60,0,360"></object>
<script defer>
function window.onload() {
  //factory.printing.paperSize = "A3"
  factory.printing.header = ""
  factory.printing.footer = ""
  factory.printing.portrait = false
  idPrint1.disabled = false; // enable UI button
  idPrint2.disabled = false;
  idPrint3.disabled = false;
  idPrint4.disabled = false;
  factory.printing.leftMargin = 0
  factory.printing.topMargin = 5
  factory.printing.rightMargin = 5
  factory.printing.bottomMargin = 5
  }
</script>
<span style="text-decoration:underline">下划线</span>
<U>dsfaldj但是拉夫;飞机士大夫按时地方螺丝钉机发射点</U>
<div class=noprint>
  <input id="idPrint1" type="button" value="打印本页"
 onclick="factory.printing.Print(false)">
  <input id="idPrint2" type="button" value="页面设置"
 onclick="factory.printing.PageSetup()">
  <input id="idPrint3" type="button" value="打印预览"
 onclick="factory.printing.Preview()">
  <input id="idPrint4" type="button"
 onclick="window.close()" value="关闭窗口">
</div>
<br/>
<table width="720" border="0" cellspacing="0" cellpadding="0" align="center" >
  <tr> 
    <td  bgcolor="#0099ff">
   这里是你要打印的内容,上面的按钮不会被打印出来<br/>
   factory.printing.paperSize = "A3"
   </td>
</tr></table></body>

解决方案 »

  1.   

    factory.printing.portrait = false

    factory.printing.portrait =true
    就改这里就可以了。
      

  2.   

    你上面用的那个控件是要安装安全证书才可以用的.
    用这个吧,这个是直接调用IE的控件来的,不过设为横向要用户动手设一下,安只是弹出一个设置的对话框出来,可以让用户设置纸张的大小和纵横向,不知合不合你要求.<body>
    <OBJECT classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 height=0 id=WB width=0>
      
    </OBJECT></body>
    调用函数:
    <script>
    function print_table(){
    document.all.WB.ExecWB(8,1);
    }
    </script>
    <input type="button" value="打印设置" onClick = "print_table()">我这段时间也在弄打印,弄了很久,如果是想对打印机直接做控制的话,都要用控件,而这些控件都需要在客户端进行安装才能用,很不方便.这个虽说要用户设置才能设,不过免去用户在客户端安装之烦.