jspdf set size code example
Example: 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');
});
}