title: converting from html to png image on initial button click
body: <p>I am converting part of the html elements into canvas and converting that into png image. It is working fine but the problem is at the first click it is not converting the html to convas and canvas to png.
  //HTML To Image on button click</p>
  
  <pre><code>$("#btn-Convert-Html2Image").on('click', function () {
  html2canvas(element, {
    onrendered: function (canvas) {
      getCanvas = canvas;
    }
  });
  setTimeout(function() {
      var imgageData = getCanvas.toDataURL("image/png");
      var newData = imgageData.replace(/^data:image\/png/, "data:application/octet-stream");
      $("#btn-Convert-Html2Image").attr("download", "your_pic_name.png").attr("href", newData);
  },400)
  
      });
  </code></pre>
  
  <p>Is that anything done wrong. Please see the <a href="https://jsfiddle.net/nbhLko0o/1/" rel="nofollow noreferrer">fiddle link</a> </p>