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即可
全网最新最细最实用WPS零基础入门到精通全套教程!带你真正掌握WPS办公! 内含Excel基础操作、函数设计、数据透视表等
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号