我正在使用Angular 6下载带有jspdf和jspdf-autotables的PDF。一切正常,直到我升级到Angular 8。
用于下载PDF的JS代码:
downloadPDF(): void {
const doc = new jsPDF({
orientation: 'l',
unit: 'mm',
format: 'a4',
});
doc.text("Company statistics", 10, 10, {});
doc.autoTable({ html: '#my-table' });
doc.save('statistics.pdf');
}
上面的代码下载只有标题为“ Company statistics”的PDF。我没有收到任何错误或警告。表#my-table中的数据不再包含在PDF中。 注意,这在Angular 6上可以正常使用,但在Angular 8上不能正常使用。
有什么想法吗?