title: Cannot read property OwnerDocument of undefined
body: <p>Running into this error,</p>
  <blockquote>
  <p>Uncaught (in promise) TypeError: Cannot read property 'ownerDocument'
  of undefined,</p>
  </blockquote>
  <p>and I believe it may have to do with how I pass the element object ID. Can someone tell me if my syntax looks correct?</p>
  <p>//Create PDf from HTML...</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 CreatePDFfromHTML(divName) {
      var HTML_Width = document.getElementById(divName).style.width;
      var HTML_Height = document.getElementById(divName).style.height;
      var top_left_margin = 15;
      var PDF_Width = HTML_Width + (top_left_margin * 2);
      var PDF_Height = (PDF_Width * 1.5) + (top_left_margin * 2);
      var canvas_image_width = HTML_Width;
      var canvas_image_height = HTML_Height;
  
      var totalPDFPages = Math.ceil(HTML_Height / PDF_Height) - 1;
  
      html2canvas(document.getElementById(divName)[0]).then(function (canvas) {
          var imgData = canvas.toDataURL("image/jpeg", 1.0);
          var pdf = new jsPDF('p', 'pt', [PDF_Width, PDF_Height]);
          pdf.addImage(imgData, 'JPG', top_left_margin, top_left_margin, canvas_image_width, canvas_image_height);
          for (var i = 1; i &lt;= totalPDFPages; i++) {
              pdf.addPage(PDF_Width, PDF_Height);
              pdf.addImage(imgData, 'JPG', top_left_margin, -(PDF_Height * i) + (top_left_margin * 4), canvas_image_width, canvas_image_height);
          }
          pdf.save("Your_PDF_Name.pdf");
          document.getElementById(divName).style.visibility = "hidden";
      });
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;button type="submit" onclick="CreatePDFfromHTML('calResult')" /&gt;Download&lt;/button&gt;</code></pre>
  </div>
  </div>
  </p>