I have borrowed the code from here and I am trying to make it work as a proof of concept in my React application.One of the issues I encounter is with line:
var pdf = new jspdf('p', 'pt', 'letter');
In such case I get the following error: TypeError: WEBPACK_IMPORTED_MODULE_2_jspdf.jspdf is not a constructor
If I remove 'new' var pdf = jspdf('p', 'pt', 'letter');
I am getting the error: TypeError: Object(...) is not a function
What am I doing wrong. It seems like it is working in all examples, but no in my editor :)
It's a typo
const jsPDF = require('jspdf')
var pdf = new jsPDF('p', 'pt', 'letter')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With