title: Convert HTML to PDF using jspdf in angular2 without using JQUERY
body: <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>import {Component, ElementRef, ViewChild} from "angular2/core";
  declare let jsPDF; 
  
  @Component({
    selector: 'my-app',
      template: `
       &lt;button (click)="pdfHtml()"&gt;Download to PDF&lt;/button&gt;
      &lt;table #test&gt;
          &lt;thead &gt;
              &lt;th class="my-class"&gt;Name&lt;/th&gt;
          &lt;/thead&gt;
          &lt;tbody&gt;
              &lt;tr *ngFor="#hero of heroes" &gt;
              &lt;td&gt;&lt;svg width="100" height="100"&gt;
    &lt;circle cx="50" cy="50" r="40" stroke="green" stroke-width="4" fill="yellow" /&gt;
  &lt;/svg&gt;&lt;/td&gt;
                  &lt;td&gt;{{hero.name}}&lt;/td&gt;
              &lt;/tr&gt;
          &lt;/tbody&gt;
      &lt;/table&gt;
     
     `,
      styles: [
    `
    .my-class {
      background-color: yellow;
    }
    `
    ]
  })
  
  export class App {
    @ViewChild('test') el: ElementRef;
  isClassVisible: true;
   heroes = [
      {id: 1, name:'Superman'},
      {id: 2, name:'Batman'},
      {id: 5, name:'BatGirl'},
      {id: 3, name:'Robin'},
      {id: 4, name:'Flash'},
       {id: 1, name:'Superman'},
      {id: 2, name:'Batman'},
      {id: 5, name:'BatGirl'},
      {id: 3, name:'Robin'},
      {id: 4, name:'Flash'}
  ];
      constructor() {
      }
  
      public download() {
          var doc = new jsPDF();
          doc.text(20, 20, 'Hello world!');
          doc.save('Test1.pdf');
      }
      
      public pdfHtml() {
        alert(this.el.nativeElement.innerHTML);
          let pdf = new jsPDF();
          let options = {
              pagesplit: true
          };
          pdf.addHTML(this.el.nativeElement, 0, 0, options, () =&gt; {
              pdf.save("test1.pdf");
          });
      }
  
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  
    &lt;head&gt;
      &lt;title&gt;angular2 playground&lt;/title&gt;
      &lt;script src="https://code.angularjs.org/2.0.0-beta.0/angular2-polyfills.js"&gt;&lt;/script&gt;
      &lt;script src="https://code.angularjs.org/tools/system.js"&gt;&lt;/script&gt;
      &lt;script src="https://code.angularjs.org/tools/typescript.js"&gt;&lt;/script&gt;
      &lt;script src="config.js"&gt;&lt;/script&gt;
      &lt;script src="https://code.angularjs.org/2.0.0-beta.0/Rx.js"&gt;&lt;/script&gt;
      &lt;script src="https://code.angularjs.org/2.0.0-beta.0/angular2.min.js"&gt;&lt;/script&gt;
      &lt;script src="https://code.angularjs.org/2.0.0-beta.0/http.min.js"&gt;&lt;/script&gt;
      &lt;script src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/0.4.1/html2canvas.min.js"&gt;&lt;/script&gt;
      &lt;script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/1.0.272/jspdf.debug.js"&gt;&lt;/script&gt;
      &lt;script&gt;
      System.import('app')
        .catch(console.error.bind(console));
    &lt;/script&gt;
    &lt;/head&gt;
  
    &lt;body&gt;
      &lt;my-app&gt;
      loading...
    &lt;/my-app&gt;
    &lt;/body&gt;
  
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>I am new to jspdf and trying to convert dynamically generated HTML table to pdf using JSPDF without using Jquery. Please check the plunker below in comments: </p>
  
  <p>I am using angular2 and need to convert the html to pdf.</p>