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\"
To work with jspdf-autotable in angular 5, one must install jspdf and jspdf-autotable via npm
npm install jspdf-autotable --save
also add the jspdf and jspdf-autotable files to the scripts array in angular-cli.json
"scripts": [
"../node_modules/jspdf/dist/jspdf.min.js",
"../node_modules/jspdf-autotable/dist/jspdf.plugin.autotable.js"
],
and in component never import jspdf or jspdf-autotable just
declare var jsPDF: any;
Of course before working with jspdf-autotable one should install jspdf and for development @types/jspdf via npm
npm install jspdf --save
npm install @types/jspdf --save-dev