jQuery打印图片pdf和txt
时间:2019-07-12 12:13:43
收藏:0
阅读:99
<!-- 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>
原文:https://www.cnblogs.com/cht1994/p/11175148.html
评论(0)