当前位置:Gxlcms > html代码 > IE直接打印页面的方式详解

IE直接打印页面的方式详解

时间:2021-07-01 10:21:17 帮助过:39人阅读

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>

以上就是IE直接打印页面的方式详解的详细内容,更多请关注Gxl网其它相关文章!

人气教程排行