I am using jspdf for converting html to pdf by following code.
html2canvas(document.getElementById("page4")).then(
function(canvas) {
document.body.appendChild(canvas);
var context = canvas.getContext("2d");
var imgData4 = canvas.toDataURL("image/jpeg");
var doc = new jsPDF(options, "", "", "");
doc.addPage();
doc.addImage(imgData4, 'jpeg', 0, 0);
doc.save(enrId + ".pdf");
});
First im converting html to jpeg. I have 4 pages so each page is separate jpeg
Then i have assigned every page into pdf page like that, im converting html to pdf.
I dont facing any problem here, but memory is a problem here
Here my problem is,
pdf size is around 1.5MB to 2MB. How can i reduce the pdf size?
If it is not possible, Suggest some other plugin for convert html to pdf