title: how to use jsPDF and jspdf-autotable in angular 5
body: <p>I am trying to use jsPDF and jspdf-autotable in my Angular 5.2.0 project. My package.json is below (related parts):</p>
  
  <pre><code>"dependencies": {
      ...
      "jspdf": "^1.3.5",
      "jspdf-autotable": "^2.3.2"
      ...
  }
  </code></pre>
  
  <p>My angular-cli.json is below (related parts):</p>
  
  <pre><code>"scripts": [
      ...
      "../node_modules/jspdf/dist/jspdf.min.js",
      "../node_modules/jspdf-autotable/dist/jspdf.plugin.autotable.js"
      ...
    ]
  </code></pre>
  
  <p>My component (related parts ):</p>
  
  <pre><code>import * as jsPDF from 'jspdf';
  import 'jspdf-autotable';
  
  @Component({
      selector: "energy-login",
      templateUrl: "./login.component.html",
      styleUrls: ["./login.component.scss"]
  })
  export class MyComponent implements OnInit {
  
      constructor() {}
  
      ngOnInit() {}
  
      downloadPDF() {
  
          let columns = ["ID", "Name", "Country"];
          let rows = [
              [1, "Shaw", "Tanzania"],
              [2, "Nelson", "Kazakhstan"],
              [3, "Garcia", "Madagascar"],
          ];
  
          let doc = new jsPDF('l', 'pt');
          doc.autoTable(columns, rows); // typescript compile time error
          doc.save('table.pdf');
      }
  }
  </code></pre>
  
  <p>It says: </p>
  
  <pre><code>[ts] Property 'autoTable' does not exist on type 'jsPDF'.
  </code></pre>
  
  <p>I tried to replace imports in my component with</p>
  
  <pre><code>// import * as jsPDF from 'jspdf';
  // import 'jspdf-autotable';
  declare var jsPDF: any;
  </code></pre>
  
  <p>then there is no compile time error but while running downloadPDF() function it says :</p>
  
  <pre><code>ERROR ReferenceError: jsPDF is not defined
  </code></pre>