4,656
edits
No edit summary |
No edit summary |
||
| Line 1,428: | Line 1,428: | ||
// inject HTML | // inject HTML | ||
doc.body.innerHTML = printHtml; | doc.body.innerHTML = printHtml; | ||
(function () { | |||
var pres = doc.querySelectorAll(".link-pdf pre"); | |||
Array.prototype.forEach.call(pres, function (pre) { | |||
// move its children out | |||
while (pre.firstChild) { | |||
pre.parentNode.insertBefore(pre.firstChild, pre); | |||
} | |||
// remove the <pre> | |||
pre.parentNode.removeChild(pre); | |||
}); | |||
})(); | |||
// sanitize: remove inner .print-no-border if user chose WITH border | // sanitize: remove inner .print-no-border if user chose WITH border | ||
| Line 1,654: | Line 1,667: | ||
document.title = desiredTitle; | document.title = desiredTitle; | ||
window._printDoc = doc; | //window._printDoc = doc; | ||
window._printFrame = iframe; | //window._printFrame = iframe; | ||
console.log("PRINT DOC READY", doc); | //console.log("PRINT DOC READY", doc); | ||
console.log("PRINT HTML", doc.body.innerHTML); | //console.log("PRINT HTML", doc.body.innerHTML); | ||
iframe.contentWindow.focus(); | |||
iframe.contentWindow.print(); | |||
// safety cleanup | // safety cleanup | ||