我正在使用html2canvas打印我的c3图表。与chrome搭配使用效果很好。但是在IE11中,它坏了。我还添加了ES6Promise.polyfill()来克服prmise问题,但是svg映像仍未加载。在IE中替代此问题的方法是什么。
PagePrint():void {
ES6Promise.polyfill();
html2canvas(document.getElementById("capture")).then(canvas => {
let popupWin;
popupWin = window.open('', '_blank', 'top=0,left=0,height=auto,width=auto');
popupWin.document.open();
var dataUrl = canvas.toDataURL('image/jpeg', 1.0);
let windowContent = '<!DOCTYPE html>';
windowContent += '<html>';
windowContent += '<head><title>Print Report</title></head>';
windowContent += '<body onload="window.print();window.close()">';
windowContent += '<img src="' + dataUrl + '">';
windowContent += '</body>';
windowContent += '</html>';
popupWin.document.write(windowContent);
popupWin.document.close();
});
}