Generating PDF requires adding transformed elements to jsPDF instances and adding html, but some elements can not be generated in pdf, so we can use html2canvas + jsPDF to convert pages into pdf. . I used jsPDF in conjuction with html2canvas and I calculated the ratio from my divâs width and height. 25,336: 716: 1.4.1: 3 months ago: 7 years ago: If you find any bugs or have a feature request, ⦠I applied that same ratio to the pdf document and the page fit perfectly onto the page without any distortion. I'm using this code for it. width: 1200, height: 1200. W3Schools offers free online tutorials, references and exercises in all the major languages of the web. Draw the image to the canvas. SECTIONS. The HTMLCanvasElement.width property is a positive integer reflecting the width HTML attribute of the