Javascript: Print PDF directly having URL
Sun Dec 24 2023 21:08:18 GMT+0000 (Coordinated Universal Time)
Saved by
@marcopinero
#javascript
function printPDFfromURL(pdf) {
var iframe = document.createElement('iframe');
iframe.style.display = 'none';
document.body.appendChild(iframe);
iframe.onload = function() {
iframe.contentWindow.print();
setTimeout(()=>{
iframe.remove()
}, 60000);
};
iframe.src = pdf;
}
//use:
// printPDFfromURL("http://localhost/path_pdf.pdf");
content_copyCOPY
Comments