Forum Discussion
Creating downloadable pdf files in Storyline - an update on earlier methods
This is the best thread I've EVER seen in the articulate community. Thanks John! I created a 3 page stunning PDF. However when I put it on the client's lms it fails when it tries to dynamically load the library using unpkg. Is there any way to get a hard copy of pdf-lib that I can include with my published files so I don't need to call to the latest version through unpkg?
- JohnCooper-be3c6 months agoCommunity Member
Hi JMorrison
It's unfortunate the way the discussion thread works. I posted this as a reply to an earlier post - but it then gets obscurred within the thread:
"Having originally started this thread 3 years ago - I'm glad to have the opportunity to post this very important update as it may affect anyone using the code I loaded. In my original example, I used an 'import' statement to fetch the necessary JavaScript library modules at runtime from unpkg.com and this code started throwing up CORS-related errors in certain browsers last week.
The root cause lies in unpkg.com not consistently sending an "Access-Control-Allow-Origin: *" CORS header with all its returned files. This header is now a mandatory requirement for ESM imports. As browsers enhance their security protocols, this previously functional code may now encounter failures.I've posted a fuller discussion of this issue in the JavaScript discussion group - with some simple ways to fix the problem.
In answer to your question - can you embed the code rather than loading it dynamically? The answer is yes, you can! Just include the JavaScript in your story.html or index .html - something like:
<script src="https://cdn.jsdelivr.net/npm/pdf-lib@1.17.1/dist/pdf-lib.min.js"></script>
(this uses the jsdelivr CDN - which is the repository that works if you use it to load the code dynamically (see the detailed article).
PS - I updated demo5.profilelearning.com from the original post so it now uses jsdelvr.net - it was failing with the same problem as above.
Related Content
- 7 months ago
- 2 months ago