0

I want to generate PDF of a html table in an Angular 8 project.

  • 1
    Possible duplicate of https://stackoverflow.com/questions/54629163/angular-7-convert-html-to-pdf – Surjeet Bhadauriya Dec 13 '19 at 10:28
  • 1
    Does this answer your question? [Angular 7: convert HTML to PDF](https://stackoverflow.com/questions/54629163/angular-7-convert-html-to-pdf) – Muldec Dec 13 '19 at 10:40

1 Answers1

2

In your ts file.

import jsPDF from 'jspdf';
import 'jspdf-autotable';


exportAsPDF()
{
  const doc = new jsPDF();
  doc.autoTable({html: '#table'});
  doc.save(this.templateName+".pdf");
}

I hope this will help.

Abhi
  • 614
  • 2
  • 12
  • 26