您的位置:首页 > Web前端 > JQuery

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

2014-07-22 00:00 459 查看
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即可
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: