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即可
最后
以上就是尊敬冬日最近收集整理的关于jQuery打印图片pdf、txt示例代码的全部内容,更多相关jQuery打印图片pdf、txt示例代码内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复