-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Closed
Description
I am using jsPdf in the version that is currently published via NPM in an Angular2 app written in Typescript.
We have the following code:
import jsPDF from 'jspdf'; // this imports jspdf.debug.js
var doc = new jsPDF(); // this throws an exception
doc.text('Hello world!', 10, 10)
doc.save('a4.pdf')
When executing this we are getting the following exception: jspdf_1.default is not a constructor. I can work around the issue by patching the jsPdf.debug file as described here: #582 and additionally adding this line:
jsPDF.default = jsPDF;
In addition I tried the latest files in the dist folder of the master branch. With those files, I need to add this line at the end of jspdf.debug.js:
})(typeof self !== "undefined" && self || typeof window !== "undefined" && window || undefined);
jsPDF.default = jsPDF; // new
return jsPDF;
Is there any workaround without changing the files in the node_modules folder?
kevin-madhu and vidhitipl