how to use jsPDF and jspdf-autotable in angular 5

后端 未结 10 945
北海茫月
北海茫月 2021-01-06 01:46

I am trying to use jsPDF and jspdf-autotable in my Angular 5.2.0 project. My package.json is below (related parts):

\"dependencies\": {
    ...
    \"jspdf\"         


        
10条回答
  •  轮回少年
    2021-01-06 02:27

    I solved this issue, first import the Jspdf import * as jsPDF from 'jspdf'; i'm used a codesmells tatic, copied the content of jspdf autotable and pasted inside the jspdf.js, then works fine for me.

    in the official site said you have to use //declare var jsPDF: any; // Important . it doesnt work in my case, try import * as jsPDF from 'jspdf'; instead.

    in angular.json in scripts :

    "./node_modules/jspdf/dist/jspdf.min.js", "./node_modules/jspdf-autotable/dist/jspdf.plugin.autotable.js",

提交回复
热议问题