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!
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!
Share Improve this question asked Apr 2, 2013 at 17:00 KosmetikaKosmetika 21.3k38 gold badges112 silver badges177 bronze badges2 Answers
Reset to default 8On 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
.
This is error of Src in iframe with full url src="domain./file.pdf"
you can try
$('.print').click(function () {
var domain = location.protocol + "//" + location.host;
var iframe = '<iframe src="'+domain+'/test.pdf" id="print-iframe" name="print-iframe"></iframe>';
$('body').append(iframe);
window.frames["print-iframe"].focus();
window.frames["print-iframe"].print();
});