Html2Canvas not working in IE9 only

假装没事ソ 提交于 2019-12-11 07:56:18

问题


I want to print div area automatically. So I have used Html2Canvas. It working perfectly in all browsers except IE9. Please correct my code if it has any bugs

function printSchedule() {              
    var browserName = '${sessionScope.BrowserContext.browserName}';

    //console.log("browserName::"+browserName);
    if(browserName != 'msie'){
        $("#printArea").html2canvas();  
    }
    else if(browserName == 'msie'){
         var el = document.createElement('printArea');
        G_vmlCanvasManager.initElement(el);
        var ctx = el.getContext('2d'); 

    }
     setTimeout(function(){         
         window.print();
     $('html').unblock();},6000);
} 

回答1:


This code works fine in all browser.

html2canvas([document.getElementById(divName)], { 
 onrendered: function (canvas) { 
   var imageData= canvas.toDataURL('image/png',1.0);
 } 
});


来源:https://stackoverflow.com/questions/18459731/html2canvas-not-working-in-ie9-only

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!