Lakshmi Priya.K
Lakshmi Priya.K

Reputation: 187

Html2Canvas not working in IE9 only

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);
} 

Upvotes: 1

Views: 3460

Answers (1)

Manoj Nayak
Manoj Nayak

Reputation: 2509

This code works fine in all browser.

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

Upvotes: 4

Related Questions