I am working with JQuery
. Now, I try to attach a link between JQuery
and jsPDF
but I get that error : Uncaught ReferenceError: jsPDF is not defined
. I've import all jsPDF
files.
I call this function to generate my pdf :
function toImprimer() {
var doc = new JSPdf();
doc.setFontSize(12);
doc.setFontType('normal');
doc.text(65, 73.60, 'Lastname');
doc.text(65, 81, 'Firstname');
// generate pdf
doc.save('Lastname_firstname.pdf');
}
And those are scripts I've imported in body tag :
<script type="text/javascript" src="dist/jsPDF/dist/jspdf.min.js" ></script>
<script type="text/javascript" src="dist/jquery.min.js" ></script>
<script type="text/javascript">
$.getScript('assets/js/myData.js');
</script>
According to the home page on https://parall.ax/products/jspdf
You should be using:
var doc = new jsPDF();
Note the differences in case to your 'JSPdf'