我有一个带有内置PDF的网页。我的代码如下所示:
<embed
type="application/pdf"
src="path_to_pdf_document.pdf"
id="pdfDocument"
width="100%"
height="100%">
</embed>我有这个javascript代码来打印我的PDF:
function printDocument(documentId) {
//Wait until PDF is ready to print
if (typeof document.getElementById(documentId).print == 'undefined') {
setTimeout(function(){printDocument(documentId);}, 1000);
} else {
var x = document.getElementById(documentId);
x.print();
}
}执行此代码时,Acrobat插件将打开著名的打印对话框。就像这样:

两个问题:
更多关于我的系统的信息:
操作系统: Windows
浏览器: Internet 7
PDF插件: Acrobat 9
发布于 2009-06-10 14:06:57
您将无法使用普通的旧JavaScript进行静默打印。您希望您的打印机如何开始打印100000000页的所有黑色。这不是件好事。如果您想要静默地打印并且只让它在上工作,那么有一些ActiveX控件可以做到这一点。这需要更高的安全设置为您的网页和您的用户真正信任您的网站。
发布于 2011-03-23 19:11:08
这在可信的Intranet环境中是可能的。
<object id="pdfDoc" style="position:absolute;z-index:-1;" name="pdfDoc" classid="clsid:CA8A9780-280D-11CF-A24D-444553540000" width="900px" height="100%">
<param name="SRC" value="yourdoc.pdf" />
</object>
<input type="button" ... onclick="pdfDoc.printAll();" />这将绕过打印对话框,直接发送到默认打印机。
发布于 2010-12-01 20:03:07
您可以在火狐中通过更改about:config来做到这一点。添加print.always_print_silent并将其设置为true。
https://stackoverflow.com/questions/975652
复制相似问题