1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > IE 8 中 JS 调用 adobe reader 打印 PDF 文档

IE 8 中 JS 调用 adobe reader 打印 PDF 文档

时间:2019-06-15 08:51:13

相关推荐

IE 8 中 JS 调用 adobe reader 打印 PDF 文档

1. 下载adobe reader 软件,并在 IE 浏览器中启用

设置 -> 管理加载项 -> 启用 Adobe PDF Reader

2. Jsp 文件中 HTML 代码如下

<input type="button" value="打印(P)" οnclick="directpdfprint('<%=imgPath_pdf %>')"><div id="createPDFDIV" style="text-align:center;margin:0 auto;height:1px;width:1px" ></div>

3. 配置 JS 方法

<script type="text/javascript">function directpdfprint(srcFile) {var pdfprint = document.getElementById("createPDF");if (pdfprint != undefined && pdfprint != null) {var parentNode = pdfprint.parentNode;parentNode.removeChild(pdfprint);}var pdfprintdiv = document.getElementById("createPDFDIV");var p = document.createElement("object");try {p.id = "createPDF";p.classid = "CLSID:CA8A9780-280D-11CF-A24D-444553540000";p.width = 1;p.height = 1;p.src = encodeURI(encodeURI(srcFile));// 处理中文名称pdfprintdiv.appendChild(p);//p.printWithDialog();// 带打印窗口的直接打印p.printAll();//直接打印} catch (e) {alert("未安装adobe reader插件,请联系管理员安装!"); }}</script>

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。