我有以下内容:
<iframe src="ACRBusinessCL.pdf" id="PDFtoPrint" height="800" width="800">
</iframe>
<form>
<input type="button" value="Print" onclick="document.getElementById('PDFtoPrint').focus(); document.getElementById('PDFtoPrint').contentWindow.print();">
</form>
让我发疯的是:我以为我曾经有过这个工作。 pdf 文件显示在 iframe 中,但是当我单击“打印”时,没有任何反应。
最佳答案
<script type="text/javascript">
function printPage(yoururl) {
var w = window.open(yoururl);
w.document.write(yoururl);
w.print();
}
</script>
关于javascript - 我可以自动将 pdf 文件发送到打印机吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6145037/