其他分享
首页 > 其他分享> > IE 11+中打印直接PDF,chrome打印pdf

IE 11+中打印直接PDF,chrome打印pdf

作者:互联网

IE 中用<embed id ="test1" src="1.pdf" type="application/pdf" width="600" heght="600" >

js print code:

let x = document.getElementById('test1');

x.print();

 

chrome中用 <iframeid ="test1" src="1.pdf" width="600" heght="600" ></iframeid >

js print code:

let x = document.getElementById('test1');

try{

x.contentWindow.document.execCommand('print',false,null);

} catch(e){

x.contentWindow.print();

}

标签:11,test1,code,chrome,打印,contentWindow,print,document
来源: https://www.cnblogs.com/Tom-yi/p/11213786.html