title: Download a Blob in PNG Format
body: <p>First of all, I hope you had a good Christmas holiday!</p>
  <p>I specify that I am a beginner in JS, hence my possible eccentric attempts to try to download my Blob in PNG.</p>
  <p><strong>My problem is to export all the graphic content of a DIV in pdf or image format by clicking on a button</strong>(the class name of the div is always the same)</p>
  <p>After some research I understood that I had to convert the div to canva to be able to download it.
  I tried to adapt the code from this post:
  <a href="https://stackoverflow.com/questions/6887183/how-to-take-screenshot-of-a-div-with-javascript">How to take screenshot of a div with JavaScript?</a></p>
  <p>But when I click on the button nothing happens despite my various modifications and tests ...</p>
  <p>Here is a preview of my code :</p>
  <pre class="lang-html prettyprint-override"><code>&lt;html lang=&quot;fr&quot;&gt;
  &lt;head&gt;
      &lt;meta charset=&quot;UTF-8&quot;&gt;
      &lt;meta http-equiv=&quot;X-UA-Compatible&quot; content=&quot;IE=edge&quot;&gt;
      &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0&quot;&gt;
      &lt;title&gt;Export Visualisation QS&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;div class=&quot;qvt-sheet-container&quot;&gt;
          &lt;h1&gt;EXPORT PNG&lt;/h1&gt; 
          &lt;img src=&quot;Logo-Qlik.png&quot;&gt;
      &lt;/div&gt;
      &lt;a id=&quot;link&quot;&gt;&lt;button id=&quot;btn-export-qs&quot;&gt;Export PNG&lt;/button&gt;&lt;/a&gt;
  &lt;/body&gt;
  
  &lt;script language=&quot;JavaScript&quot; type=&quot;text/javascript&quot; src=&quot;jquery-3.6.0.min.js&quot;&gt;
  var a = document.getElementById(&quot;link&quot;);
  function export_feuille() {
      $(&quot;#btn-export-qs&quot;).click(function() {
          html2canvas($(&quot;.qvt-sheet-container&quot;), {
              onrendered: function(canvas) {
                  //theCanvas = canvas;
                  canvas.toBlob(function(blob) {
                      //saveAs(blob, &quot;Dashboard.png&quot;);
                      url = window.URL.createObjectURL(blob);
                      a.href = url;
                      a.download = &quot;export_qs.png&quot;;
                      a.click();
                      window.URL.revokeObjectURL(url);
                  });
              }
          });
      });
  };
  
  document.getElementById(&quot;btn-export-qs&quot;).addEventListener (&quot;click&quot;, export_feuille, false);
  
  &lt;/script&gt;
  &lt;/html&gt;
  </code></pre>
  <p>If anyone could educate me on what is wrong or point me in a direction I would be very grateful :)</p>