Home > Enterprise >  jspdf_autotable__WEBPACK_IMPORTED_MODULE_8__ is not a function
jspdf_autotable__WEBPACK_IMPORTED_MODULE_8__ is not a function

Time:01-10

I have been created a library with jsPDF and JS autotable plugin on an Angular 13 app. It works very well inside the example project that comes with the library.

component.ts

import jsPDF from 'jspdf';
import autoTable from 'jspdf-autotable';

exportPdf() {
        const doc = new jsPDF(this.pageOrientation, 'pt');
        autoTable(doc, {
            columns: this.exportableColumns,
            body: this.options.data
        });
        doc.save("exported_file.pdf");
    }

template.html

<p-button type="button" label="Export" (click)="exportPdf()"></p-button>

Now, I'm trying to use the library as a dependency inside another project, but the following message error appear clicking the dependency button pdf generate.

enter image description here


Inside both projects

@angular/core: "~13.2.0", 
jspdf: "^2.5.1", 
jspdf-autotable: "^3.5.28"

Could someone tell me what's going on? And if possible try to help me? Thanks in advance!

CodePudding user response:

@vladimir-banderov gave the perfect solution which is here!

https://stackoverflow.com/a/55912081/1394045

Thankyouuuuu!!!

  • Related