我尝试过以下2种方法..
<embed src="assets/pdf/mypdf.pdf" id="Pdf1" name="Pdf1" hidden="true">
<a class="print" onClick="document.Pdf1.printWithDialog();"></a>
<a onClick="document.getElementById('Pdf1').printWithDialog()" style="cursor:hand;">Print file</a>
又一次尝试..
<script type="text/javascript">
function printPDF(pdfUrl)
{
var w = window.open(pdfUrl);
w.print();
}
</script>
<a class="print" onClick="printPDF("assets/pdf/mypdf.pdf");">a</a>
似乎没有一个起作用。有什么解决方案可以让我单击链接并将 pdf 发送到打印对话框吗? window.print 只是在对话框中显示实际站点,而不是 pdf。
None
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)