html - Print PDF file with Javascript in all popular browser -
how print pdf file using javascript across popular browser? have done quite extensive research on question , there no real solutions.
first approach use iframe, however, iframe not practise. code listed following.
function printiframepdf(){ window.frames["printf"].focus(); try { window.frames["printf"].print(); } catch(e){ window.print(); console.log(e); } } second approach use <embed> or <object>tag display pdf , use document.getelementbyid(pdfid).print() print. however, chrome not support function. code listed following.
function printobjectpdf() { document.getelementbyid('idpdf').print(); } is there solution this?
Comments
Post a Comment