How to calculate div height which is converted as image to fit the PDF using jsPDF & html2Canvas?
问题 I am converting div to image by using html2canvas. I want to calculate height of the div(in px) such that it will fit on the PDF page maintaining the aspect ratio of image It should work on all window sizes(larger screens, IPAD, Desktop, laptop). I am using jsPDF for generating PDF Here is the fiddle example http://jsfiddle.net/akshay1818/ys0z984x/51/ HTML Code <div id="target"> Set div height(in px) such that it will fit on the page maintaing the aspect ratio </div> <button onclick=