ДЛЯ ANGULAR
ШАГ 1: npm install jspdf-autotable
или в index.html в add:
ШАГ 2: в Angular-cli.json add:
"scripts": [
"../node_modules/jspdf/dist/jspdf.min.js",
"../node_modules/jspdf-autotable/dist/jspdf.plugin.autotable.js"
],
ШАГ 3: app.component.ts или любой другой компонент, связанный ниже импорта
import {Component} из '@ angular / core'
declare var jsPDF: any;
ШАГ 4: для теста, помещенного в ваш компонент:
export class AppComponent {
title = 'app works!';
public columns: string[] = ['Name', 'Phone', 'Whatsapp'];
public data: string[] = ['Diego Venâncio', '79999565796', '79912345678'];
constructor() {
var doc = new jsPDF('p', 'pt');
doc.autoTable(columns, data);
doc.save("table.pdf");
}
}