Answers for "jspdf reduce size file"

0

jspdf reduce size file

function genPDF() {

  html2canvas(document.querySelector(".page"), {scale: "2"}).then(canvas => {

    this.imgFile = canvas.toDataURL("image/jpeg", 0.3);
    var doc = new jsPDF('p', 'mm', 'a4', true);
    //and here is the trick, use FAST to add the canvas or any image:
    doc.addImage(this.imgFile, "JPEG", 5, 0, 210, 297, undefined,'FAST');
    doc.save('Test.pdf');

  });

}
Posted by: Guest on January-15-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language