jQuery打印图片pdf、txt示例代码
程序员文章站
2022-07-09 18:33:21
html加如下代码
html加如下代码
<p style="display:none"> <p id="to_print"></p> <input type="button" id="print_button" value="Print" onclick="document.getElementById('FILEtoPrint').focus(); document.getElementById('FILEtoPrint').contentWindow.print();" /> </p> <script> function printSome(path){ //传入文件路径 $("#to_print").html('<iframe src='+path+' id="FILEtoPrint"></iframe>'); setTimeout(function(){$("#print_button").click();}, 500); } </script>
web界面添加按钮调用js即可
上一篇: 回调函数
下一篇: 碧螺春和龙井哪个贵?怎么挑选碧螺春?