Javascript - print pdf to iframe with Firefox workaround
I am using this bit of javascript to print a PDF that is displayed in an iframe.
function printPage()
{
var div = document.getElementById("printerDiv");
div.innerHTML = '<iframe src="/cgi-bin/pr.pl?tx.pdf" onload="this.contentWindow.focus();this.contentWindow.print();"></iframe>';
}
Works fine in Chrome, but in Firefox I am getting the following error due to a Firefox bug that has been around for over a year
Error: permission denied to access property "print"
Can anyone suggest a workaround that will allow me to print a PDF document in Firefox without displaying it? Obviously I'm using an iframe (out of sight) for this now, but that seems to be the problem. Unfortunately there is no way to use Chrome.
**
+3
jmf1205
source
to share
No one has answered this question yet
Check out similar questions:
1542
1535
763
591
15
five
1
1
0
0