Firefox printing PDF in an iframe throws an error

firefox, javascript, printing

Solution

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`.

Problem

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!

Original source

Related problems