jsPDF addImage方法在IE9中不起作用?我们无法在IE9中下载pdf?

时间:2016-08-26 04:55:19

标签: internet-explorer-9 jspdf

请在代码中告诉我任何错误。 我的代码:

(function(){
var  form = $('.form');
// cache_width = form.width(),
 a4  =[ 595.28,  841.89];  // for a4 size paper width and height
$('#create_pdf').on('click',function(){
 $('body').scrollTop(0);
 createPDF();
});

//create pdf
function createPDF(){
alert(JSON.stringify(getCanvas()));
 getCanvas().then(function(canvas){
  var   img = canvas.toDataURL("image/jpeg"),
  doc = new jsPDF({
          unit:'px', 
          format:'a4'
        });     
        doc.addImage(img, 'JPEG', 20, 20);
        doc.save('techumber-html-to-pdf.pdf');   
       // form.width(cache_width);  
 });  
}    

// create canvas object
function getCanvas(){
 //form.width((a4[0]*1.33333) -80).css('max-width','none');
 return html2canvas(form,{
     imageTimeout:2000,   
     removeContainer:true  
    });   
}
}());

0 个答案:

没有答案