I need to create a PDF in Javascript. I have found the npm Package "jsPDF". I have installed "jsPDF" with npm install jspdf
. It succesfully installed, but when I execute the fowolling code:
const jspdf = require ('jspdf');
let doc = new jspdf();
doc.setFontSize(40);
doc.text(35, 25, 'PDF with jsPDF!');
I get an error which says ReferenceError: window is not defined
.
Do anybody know what's wrong in my code or if some imports are missing?