1、 通過在IE中載入adobe pdf reader 插件 進行直接列印和列印的配置(推薦) <body> <object id="pdf1" width="1000px" height="400px" classid="clsid:CA8A9780-280D-11CF-A24D-44455354 ...
1、 通過在IE中載入adobe pdf reader 插件 進行直接列印和列印的配置(推薦) <body> <object id="pdf1" width="1000px" height="400px" classid="clsid:CA8A9780-280D-11CF-A24D-444553540000"> <param name="src" value="../xdoc/testDoc.do"> </object> <script language="JavaScript"> pdf1.SetShowToolbar (false); </script> <input type="button" value="列印" onclick="pdf1.printAll()"> <input type="button" value="列印(帶對話框)" onclick="pdf1.printWithDialog()"> </body> 2、通過 smsx.cab 列印控制項進行直接列印 <object id="factory" style="display:none" classid="clsid:1663ed61-23eb-11d2-b92f-008048fdd814" codebase="smsx.cab#Version=6,3,435,20"> </object> <script type="text/JavaScript"> function setting () { if(!factory.object) { alert("列印控制項沒有正確安裝!"); return; } else { factory.printing.header = "";//頁眉 factory.printing.footer = "";//頁腳 factory.printing.leftMargin = 1.0;//左邊距 factory.printing.topMargin = 1.3;//上邊距 factory.printing.rightMargin = 1.0;//右邊距 factory.printing.bottomMargin = 1.3;//下邊距 factory.printing.portrait = true;//列印方向,true:縱向.false:橫向 } } </script> </head> <script type="text/javascript"> function printPDF(){ factory.printing.Print(true, $("#printIframe")[0].contentWindow.html); } </script> <body onload="setting()"> <input type="button" value="列印PDF" onclick="printPDF()"/> <iframe style="display:block; width:1200px; height:700px;" name="printIframe" id="printIframe" src="../xdoc/testDoc.do"></iframe> </body>