title: Print a screenshot from web page
body: <p>I'm creating a web page and I need to make a button that prints a selected area. After several searches everything led me to implement <a href="https://html2canvas.hertzen.com/" rel="nofollow noreferrer">html2canvas</a>.
  I installed it with 
  <strong><em>npm install html2canvas</em></strong> in the command prompt. In the official html2canvas website they mention 
  <strong><em>import html2canvas from 'html2canvas';</em></strong> that I suppose I need to add in the top of my aspx file(?)
  So far I've coded this code portion:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function getScreenshot() {
    alert("bob");
    html2canvas(document.body, {
      onrendered: function(canvas) {
        var canvasImg = canvas.toDataURL("image/jpg");
        $('#test').html('&lt;img src="' + canvasImg + '" alt=""&gt;');
      }
    });
    var printContent = document.getElementById("row");
    var printWindow = window.open("", "");
    printWindow.document.write(printContent.innerHTML);
    printWindow.document.write("&lt;script src=\'http://code.jquery.com/jquery-1.10.1.min.js\'&gt;&lt;\/script&gt;");
    printWindow.document.write("&lt;script&gt;$(window).load(function(){ print(); close(); });&lt;\/script&gt;");
    printWindow.document.close();
  };</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div id="test" class="body-content animated fadeIn"&gt;
    &lt;a href="javascript:getScreenshot()"&gt;
      &lt;img src="Images/printer.png" width="40" height="40" align="right"&gt;
    &lt;/a&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>The issue is when I click the button, no window opens for printing. The button works for sure because I get the alert window.
  What am I missing for this to work? Can be a installation procedure? Can be bad attributes implementation?</p>