Forum Discussion
Creating a pdf file from Storyline running under an LMS
Hi John, after 4 hours of trial and error, i've figured it out.
Apparently jsPDF versions after v1.5.3 simply do not work. I've tested each version working backwards from the most recent (as of this post v2.5.1) and found that v1.5.3 is the most recent one that works.
I was stumped and ended up in a google rabbit hole before stumbling across another thread on the web about trying older versions.
From the changelog for v2.0.0:
Modernized the output bundles: there are now bundles for ES modules, UMD and a special node version. We renamed the files in dist for consistency: jspdf.debug/min.js is now jspdf.umd(.min).js. We also changed the name of the global variable to jspdf (lower case) when using script tags to be consistent with the new es modules format and named imports/exports. For backwards compatibility add this line:
window.jsPDF = window.jspdf.jsPDF
Yet whenever i add the line "window.jsPDF = window.jspdf.jsPDF" it still doesn't work. So i've just decided to simply use v1.5.3 and baking it locally within the scorm file.
Have you had much success with any of the more recent versions of jsPDF?
Hi Ariff
No. As per my earlier post, I just hadn't got round to testing my code with the later versions of jsPdf. Like you, I used v1.5.2 and, as you say, 'baked' that into the SCORM code.
I may take a look at it and see if I can get the UMD version working. Hopefully, you have got your code working OK now? Albeit with V1.5.3.
I'm also interested in the JavaScript library pdf-lib as this allows you to fill in a pdf form which would be really useful.
If I get anywhere useful I will post here.
Regards, John