火狐在iframe中打印PDF会引发错误 [英] Firefox printing PDF in an iframe throws an error
问题描述
需要帮助
我需要将PDF加载到 iframe
中,然后点击打印对话框。
我有这样的代码:
$('。print' ).click(function(){
var iframe ='< iframe src =test.pdfid =print-iframename =print-iframe>< / iframe>';
$('body')。append(iframe);
window.frames [print-iframe]。focus();
window.frames [print-iframe]。print ();
});
它在Chrome中完美运行。但在Firefox中,我有这样一个错误:
错误:权限拒绝访问属性'打印'
。
<我怎样才能解决它?感谢!
在Firefox的最新版本(自19)以来,必须禁用错误的本地PDF查看器(pdf。 js)在 about:config
中。将 pdfjs.disabled
属性设置为 true
,您将看到使用脚本显示的打印窗口。
如果开始下载,请将 plugin.disable_full_page_plugin_for_types
属性设置为 application / pdf
。
Need help
I need to load PDF into iframe
while clicking and then call print dialog on it.
I have such code:
$('.print').click(function () {
var iframe = '<iframe src="test.pdf" id="print-iframe" name="print-iframe"></iframe>';
$('body').append(iframe);
window.frames["print-iframe"].focus();
window.frames["print-iframe"].print();
});
It works perfectly in Chrome. But in Firefox I have such an error:
Error: Permission denied to access property 'print'
.
How can I work around it? Thanks!
On recent versions of Firefox (since 19), you have to disable the bugged and native PDF viewer (pdf.js) in about:config
. Set the pdfjs.disabled
property to true
and you will see the print window appearing using your script.
If there's a download starting, set the plugin.disable_full_page_plugin_for_types
property to application/pdf
.
这篇关于火狐在iframe中打印PDF会引发错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!