How to print a PDF in Firefox?
This function works in Chrome but not in Firefox
function print_pdf(url){
var id = \'iframe\', html = \'
You can implement print function without create new iframe (only with css) to prevent security problems:
var style = document.createElement("style");
style.setAttribute("media", "print"); //style.setAttribute("media", "screen,print");
style.appendChild(document.createTextNode(""));
document.head.appendChild(style);
var width = $("#printDiv").width();
var height = $("#printDiv").height();
style.sheet.insertRule("body { width: 210mm !important, height: 25.4mm !important; visibility: hidden; }", 0);
style.sheet.insertRule("#printDiv { visibility: visible; position: fixed !important;top: 5px; left: 5px; width:" + width + "px;height:" + height + "; page-break-after: avoid;}", 0);
window.focus();
window.print(true);
style.remove();