How can i use jsPDF where the width and height is dynamic? When the document height/width is large, i cannot seem to adjust the settings.
$(document).on("click", ".download-pdf", function() {
html2canvas(document.body).then(function(canvas) {
var imgData = canvas.toDataURL("image/jpeg", 1.0);
var pdf = new jsPDF('p', 'mm', [400, 480]);
pdf.addImage(imgData, 'JPEG', 20, 20);
pdf.save("screen-3.pdf");
});
});
After years ...
Should be:
$(document).on("click", ".download-pdf", function() {
html2canvas(document.body).then(function(canvas) {
var imgData = canvas.toDataURL("image/jpeg", 1.0);
var pdf = new jsPDF('p', 'mm', [400, 480]);
pdf.addImage(imgData, 'JPEG', 0, 0, 400, 480);
pdf.save("screen-3.pdf");
});
});
Most helpful comment
After years ...
Should be: