Answers for "jspdf addimage auto height"

1

jspdf addimage auto height

// You can get the width and height of PDF document like below,
let doc = new jsPDF("p", "mm", "a4");
let width = doc.internal.pageSize.getWidth();
let height = doc.internal.pageSize.getHeight();

// Then you can use this width and height for your image to fit the entire PDF document.
let imgData = 'data:image/jpeg;base64,/9j/4AAQSkZJ......';
doc.addImage(imgData, 'JPEG', 0, 0, width, height);
Posted by: Guest on March-25-2022

Code answers related to "Javascript"

Browse Popular Code Answers by Language