删除消息选择打印机并使用javascript自动打印文档

remove message select printer and automatically print the document with javascript

本文关键字:javascript 打印 文档 消息 选择 打印机 删除      更新时间:2023-09-26

我正在打印文档,并找到了一个使用javascript的替代方案。

代码为:

 <html>
<head>
<script type="text/javascript">
function printpage()
{
   window.print();
   window.close();
}
</script>
</head>
<body onload="printpage()">
<embed src="pdfhere.pdf"/>
</body>
</html>

如果我创建了一个html页面并用internet explorer打开它,我会发送一条消息来选择打印机并打印文档。我要做的是在不显示该消息的情况下自动打印文档谢谢你的帮助。

您不能跳过浏览器打印对话框。这是由您的浏览器/OS提供的。

window.print()是你能做的最好的。