title: Create and download pdf from div on angular 2
body: <p>I'm trying to create and download an PDF from an existing div with jsPDF.</p>
  
  <p>I have tried many ways but I can't achieve it.</p>
  
  <p>My last try was with <code>@ViewChild</code> and <code>ElementRef</code> but doesn't work to.</p>
  
  <p>detail-devis.component.ts:</p>
  
  <pre><code>import {Component, ElementRef, ViewChild} from "angular2/core";
  declare let jsPDF; 
  
  @Component({
  selector: 'my-app',
  template: `&lt;div #test&gt;
      Hello world
    &lt;/div&gt;
    &lt;button type="button" (click)="test()"&gt;pdf&lt;/button&gt;
    &lt;button (click)="download()"&gt;download&lt;/button&gt;`
  })
  
  export class App {
  
    @ViewChild('test') el: ElementRef;
  
    constructor() {
    }
  
    public download() {
      var doc = new jsPDF();
      doc.text(20, 20, 'Hello world!');
      doc.save('Test.pdf');
    }
  
    public test() {
      let pdf = new jsPDF('l', 'pt', 'a4');
      let options = {
        pagesplit: true
      };
      pdf.addHTML(this.el.nativeElement, 0, 0, options, () =&gt; {
        pdf.save("test.pdf");
      });
    }
  }
  </code></pre>
  
  <p><a href="http://plnkr.co/edit/jNaeC7fpRA2z9n9NEkfm?p=preview" rel="noreferrer">Plunker</a></p>
  
  <p>Someone know the simplest way to achieve this with Angular 2?</p>