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 :
JavaScript
x
10
10
1
function toImprimer() {
2
var doc = new JSPdf();
3
doc.setFontSize(12);
4
doc.setFontType('normal');
5
doc.text(65, 73.60, 'Lastname');
6
doc.text(65, 81, 'Firstname');
7
// generate pdf
8
doc.save('Lastname_firstname.pdf');
9
}
10
And those are scripts I’ve imported in body tag :
JavaScript
1
6
1
<script type="text/javascript" src="dist/jsPDF/dist/jspdf.min.js" ></script>
2
<script type="text/javascript" src="dist/jquery.min.js" ></script>
3
<script type="text/javascript">
4
$.getScript('assets/js/myData.js');
5
</script>
6
Advertisement
Answer
According to the home page on https://parall.ax/products/jspdf
You should be using:
JavaScript
1
2
1
var doc = new jsPDF();
2
Note the differences in case to your ‘JSPdf’