Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Please forgive me because this is a new foray for me. I am trying to integrate jsPDF (Documentation) into my mashup to print multiple pdfs. I have multiple problems. The first is that the require seems to point to the resources folder instead of locally so I have to use an absolute URL to get the actual file. When importing from "https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.5.1/jspdf.umd.min.js" I get an error jsPDF is not a constructor. I feel like I am missing something. Like I should install it via node to the server or something and call it that way. Or possibly I have the wrong js file from the library. Any help is appreciated.
I am using this codepen as a basis for testing the basic principle. https://codepen.io/AshikNesin/pen/KzgeYX?editors=1111
I got it working by copying the set up of the codepen. What I had to do was add
<script src='https://cdnjs.cloudflare.com/ajax/libs/jspdf/1.2.61/jspdf.min.js'></script>
before the script in the body of the html. It is an older version of jsPDF but it will get the job done. If anyone has a better way of doing this I will leave this up for replies.
I got it working by copying the set up of the codepen. What I had to do was add
<script src='https://cdnjs.cloudflare.com/ajax/libs/jspdf/1.2.61/jspdf.min.js'></script>
before the script in the body of the html. It is an older version of jsPDF but it will get the job done. If anyone has a better way of doing this I will leave this up for replies.
I was able to improve it a bit. I updated the script to work all the way to 1.5.3 and had to add html2canvas after that. Also something is up with the require calls so I had to move that script call down below those two. I found this thread helpful, particularly the second answer.