Javascript 打印显示在<;对象>;标记角2
我已经在Angular2中创建了一个弹出窗口,它将显示来自服务器的PDF文件,就像一个报告查看器一样,这个PDF嵌入在下面的标记中Javascript 打印显示在<;对象>;标记角2,javascript,angular,Javascript,Angular,我已经在Angular2中创建了一个弹出窗口,它将显示来自服务器的PDF文件,就像一个报告查看器一样,这个PDF嵌入在下面的标记中 <object width="870" height="650" type="application/pdf" data="http://localhost/amar/test.pdf?#zoom=85&scrollbar=0&toolbar=0&navpanes=0" id="doc"> </object> 我试
<object width="870" height="650" type="application/pdf" data="http://localhost/amar/test.pdf?#zoom=85&scrollbar=0&toolbar=0&navpanes=0" id="doc">
</object>
我试过使用postMessage()它也不起作用
var PrintThis = function (val) {
printWindow.focus();
printWindow.print();
}
printWindow.addEventListener("message", PrintThis);
printWindow.postMessage("Print", "*");
//in this case iam able to get the data in printhis()
//but its also not working
请帮助我或为我提供如何以angular2或Javascript打印PDF的想法那么问题出在哪一部分?在新窗口打开?印刷?或者两者都可以?我可以打开但无法打印。那么问题出在哪一部分?在新窗口打开?印刷?或者两者都可以?我可以打开但不能打印
var PrintThis = function (val) {
printWindow.focus();
printWindow.print();
}
printWindow.addEventListener("message", PrintThis);
printWindow.postMessage("Print", "*");
//in this case iam able to get the data in printhis()
//but its also not working