jQuery打印图片,pdf,txt

来源:互联网 发布:小型气动编程压力机 编辑:程序博客网 时间:2024/06/05 07:42
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即可
0 0
原创粉丝点击