开发者

Can I send a pdf file to the printer automatically? [duplicate]

开发者 https://www.devze.com 2023-03-08 12:15 出处:网络
This question already has answers here: How do I print an IFrame from javascript in Safari/Chrome (12 answers)
This question already has answers here: How do I print an IFrame from javascript in Safari/Chrome (12 answers) Closed 7 years ago.

I have the following:

<iframe src="ACRBusinessCL.pdf" id="PDFtoPrint" height="800" width="800">
</iframe>
<form>
<input type="button" value="Print" onclic开发者_如何学Pythonk="document.getElementById('PDFtoPrint').focus(); document.getElementById('PDFtoPrint').contentWindow.print();">
</form>

What's driving me crazy is: I thought I had this working at one point. The pdf file is showing up in the iframe, but when I click Print, nothing happens.


<script type="text/javascript">
    function printPage(yoururl) {
            var w = window.open(yoururl);
            w.document.write(yoururl);
            w.print();
    }

</script>
0

精彩评论

暂无评论...
验证码 换一张
取 消