jQuery打印图片pdf、txt示例代码

软件发布|下载排行|最新软件

当前位置:首页IT学院IT技术

jQuery打印图片pdf、txt示例代码

  2020-05-13 我要评论

html加如下代码

<div style="display:none"> 
<div id="to_print"></div> 
<input type="button" id="print_button" value="Print" onclick="document.getElementById('FILEtoPrint').focus(); document.getElementById('FILEtoPrint').contentWindow.print();" /> 
</div> 

<script> 
function printSome(path){ //传入文件路径 
$("#to_print").html('<iframe src='+path+' id="FILEtoPrint"></iframe>'); 
setTimeout(function(){$("#print_button").click();}, 500); 
} 
</script>

web界面添加按钮调用js即可

Copyright 2022 版权所有 软件发布 访问手机版

声明:所有软件和文章来自软件开发商或者作者 如有异议 请与本站联系 联系我们