Bhaskar kumar
Bhaskar kumar

Reputation: 29

How to generate PDF of a HTML table in Angular 8

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

Upvotes: 0

Views: 620

Answers (1)

Abhi
Abhi

Reputation: 684

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.

Upvotes: 2

Related Questions