title: Export Pdf from html in angular 6
body: <p>I want to export pdf from html in angular 6. So, I'm using <code>jspdf</code> library. But I can't giving styling like color and background color. How can I achieve this? <strong>(If is there any other free library from <code>jspdf</code>, I can use it)</strong> You can see demo from below link.</p>
  
  <p><a href="https://stackblitz.com/edit/angular-urzyet?file=src%2Fapp%2Fapp.component.ts" rel="nofollow noreferrer">DEMO</a></p>
  
  <p><strong>.ts file</strong></p>
  
  <pre><code>export class AppComponent  {
    @ViewChild('reportContent') reportContent: ElementRef;
  
      downloadPdf() {
      const doc = new jsPDF();
      const specialElementHandlers = {
        '#editor': function (element, renderer) {
          return true;
        }
      };
  
      const content = this.reportContent.nativeElement;
  
      doc.fromHTML(content.innerHTML, 15, 15, {
        'width': 190,
        'elementHandlers': specialElementHandlers
      });
  
      doc.save('asdfghj' + '.pdf');
    }
  }
  </code></pre>
  
  <p><strong>.html file</strong></p>
  
  <pre><code>&lt;div #reportContent class="p-col-8 p-offset-2"&gt;
    &lt;table&gt;
      &lt;tr&gt;
        &lt;td style="color: red;background-color: blue;border:solid;"&gt;1111
        &lt;/td&gt;
        &lt;td style="border:solid;"&gt;2222
        &lt;/td&gt;
      &lt;/tr&gt;
    &lt;/table&gt;
  &lt;/div&gt;
  
  &lt;button pButton type="button" label="Pdf" (click)="downloadPdf()"&gt;Export Pdf&lt;/button&gt;
  </code></pre>