![](/img/trans.png)
[英]Angular 8, using jspdf and autotable-jspdf import/usage issues
[英]Import jsPDF autoTable plugin to ionic angular project
我想在ionic / angular 4項目中創建pdf。 我將jsPDF與jspdf-autotable插件結合使用,通過按按鈕來創建pdf文檔。
import * as jsPDF from 'jspdf';
import { autoTable } from 'jspdf-autotable';
doc.autoTable帶下划線:[ts]類型'jsPDF'上不存在屬性'autoTable'。 [2339]因為它是一個插件...
var doc = new jsPDF();
doc.autoTable({head: head, body: body, startY: 80 });
doc.save('Test.pdf');
如何在ionic / angular中將插件添加到jsPDF?
嘗試以下“
"scripts": [
"../node_modules/jspdf/dist/jspdf.min.js",
"../node_modules/jspdf-autotable/dist/jspdf.plugin.autotable.js"
],
在您的組件中:
import * as jsPDF from 'jspdf';
import 'jspdf-autotable';
.
.
.
jsPDF: any; //important
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.