title: Angular- jsPDF warnings, uncexpected tocken and jsPDF.fromHTML is not a function
body: <p>I want to print html code whit jsPDF in Angular but i cant. i need help, look.</p>
  <p>ts.config.app.json</p>
  <pre><code>{
    &quot;extends&quot;: &quot;./tsconfig.base.json&quot;,
    &quot;compilerOptions&quot;: {
      &quot;outDir&quot;: &quot;./out-tsc/app&quot;,
      &quot;types&quot;: [],
      &quot;allowSyntheticDefaultImports&quot;: true
    },
    &quot;files&quot;: [
      &quot;src/main.ts&quot;,
      &quot;src/polyfills.ts&quot;
    ],
    &quot;include&quot;: [
      &quot;src/**/*.d.ts&quot;
    ]
  }
  </code></pre>
  <p>npm jspdf module</p>
  <p><a href="https://i.stack.imgur.com/lgSk3.png" rel="nofollow noreferrer">enter image description here</a></p>
  <p>angular.json scripts</p>
  <pre><code> &quot;scripts&quot;: [
                &quot;node_modules/jquery/dist/jquery.js&quot;,
                &quot;node_modules/popper.js/dist/umd/popper.js&quot;,
                &quot;node_modules/bootstrap/dist/js/bootstrap.js&quot;,
                &quot;node_modules/jspdf/dist/jspdf.es.min.js&quot;
              ]
  </code></pre>
  <p>if in the class i import like this <code>import jsPDF from 'jspdf';</code> or like this <code>import { jsPDF } from &quot;jspdf&quot;;</code> i get this warning and this error.</p>
  <p>warning:</p>
  <pre><code>WARNING in ./node_modules/jspdf/dist/jspdf.umd.min.js 195:141-151
  Critical dependency: the request of a dependency is an expression
  
  WARNING in ./node_modules/jspdf/dist/jspdf.umd.min.js 195:240-254
  Critical dependency: the request of a dependency is an expression
  </code></pre>
  <p>error:</p>
  <pre><code>scripts.js:18390 Uncaught SyntaxError: Unexpected token 'export'
  </code></pre>
  <p>if i import jspdf like this <code>import * as jsPDF from &quot;jspdf&quot;;</code> i get this error:</p>
  <p>error:</p>
  <pre><code>Type 'typeof import(&quot;jspdf&quot;)' has no construct signatures.
      const doc = new jsPDF('p', 'pt', 'letter');
  </code></pre>
  <p>this is my class:</p>
  <pre><code>//PDF
  // import { jsPDF } from &quot;jspdf&quot;;
  import jsPDF from 'jspdf';
  // import * as jsPDF from &quot;jspdf&quot;;
  
  @Component({
    selector: 'app-cash-register',
    templateUrl: './cash-register.component.html'
  })
  export class CashRegisterComponent implements OnInit {
  
  @ViewChild(&quot;ticket&quot;) ticket: ElementRef;
  
  public printPDF(): void {
      var pdf = this.ticket.nativeElement.innerHTML;
      const doc = new jsPDF('p', 'pt', 'letter');
  
      const margins = {
        top: 80,
        bottom: 60,
        left: 40,
        width: 522
      };
  
      doc.html(pdf, {
        callback: function(doc) {
          doc.save(&quot;Test1.pdf&quot;);
        }
      })
  
      // or
      
      doc.fromHTML(pdf, margins.left, margins.top, {}, function () {
  
        doc.save(&quot;Test2.pdf&quot;);
      }, margins);
    }
  }
  </code></pre>
  <p>and if i not import jspdf in angular.json i get this error when i tried to download:</p>
  <pre><code>core.js:4197 ERROR TypeError: doc.fromHTML is not a function
  </code></pre>