title: Property 'toDataURL' does not exist on type 'HTMLElement'
body: <p>Hi I am new to TypeScript. I am trying to generate bar code in canvas using JSBarcode and add it to JSpdf as image using <code>addImage</code>. But I am getting the above error.</p>
  
  <h2>barcode.html</h2>
  
  <p>This is my html code. By click the generate button it has created the barcode. But when I convert my html to PDF it gives the above error.</p>
  
  <pre><code>&lt;canvas id="barcode"&gt;&lt;/canvas&gt;
  &lt;a id="download"  download="barcode.png" (click)='Generate();'&gt;Generate&lt;/a&gt;
  &lt;button (click)='Generatepdf();'&gt;PDF&lt;/button&gt;
  </code></pre>
  
  <h2>barcode.ts</h2>
  
  <pre><code>private Generate(): void {
      JsBarcode("#barcode", "12345", {
              width: 2,
              height: 25
          });
      }
  
  Generatepdf() 
  {
       var pdf = new jsPDF('p', 'pt', 'letter');
       let canvas =document.getElementById('barcode');
       console.log(canvas);
       let dataURL = canvas.toDataURL("image/jpeg");
       pdf.addImage(dataURL, 'JPEG', 15, 40, 180, 160);
       function (dispose) {
          pdf.output('datauri');
       }, margins);
  }
  </code></pre>