簡體   English   中英

在IE11上打印不工作

[英]print not workig on IE11

我正在使用blob url和iFrame來打印文檔。 它在Chrome中運行良好,但在IE中無效。

任何人都可以告訴我如何打印在iframe src中設置的blob網址?

let file = new Blob([res.blob()], { type: 'application/pdf' });

let blobURL = URL.createObjectURL(file);// here file is blob object
let iframe = document.createElement('iframe');                        

document.getElementById('viewerContainer').appendChild(iframe);

iframe.onload = function () {
    iframe.contentWindow.print();
};

iframe.src = blobURL;

我不知道IE7的具體情況,但我在Firefox中遇到了類似的錯誤。 這個在內容完全加載之前觸發onload事件。 不幸的是,我找不到解決方案。 所以我狡猾地使用了setTimeout()。
此解決方案很弱但您可以使用setTimeout(time),其時間允許您加載文檔的完整內容。 此時警告取決於網絡連接

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM