Add image in pdf using jspdf

前端 未结 12 710
离开以前
离开以前 2020-12-05 06:49

I am using jspdf to convert an image into a PDF.

I have converted the image into a URI using base64encode. But the problem is that there are no errors or warnings sh

12条回答
  •  被撕碎了的回忆
    2020-12-05 07:42

    The above code not worked for me. I found new solution :

     var pdf = new jsPDF();
     var img = new Image;
     img.onload = function() {
         pdf.addImage(this, 10, 10);
         pdf.save("test.pdf");
     };
     img.crossOrigin = "";  
     img.src = "assets/images/logo.png";
    

提交回复
热议问题