Forum Discussion
Creating downloadable pdf files in Storyline - an update on earlier methods
Hi Hunter,
I got my version of this working with the PDF form included in the zip file. But I intend to embed these Storyline "forms" in some Rise courses instead of publishing the standalone Storyline projects, in which case I think the PDF document would need to be hosted externally instead of included in the zip file. Do you know what the URL would look like in the JavaScript if pointing at the file hosted on SharePoint?
Thanks!
Files hosted on SharePoint are typically not served with the correct MIME types or headers needed for direct binary access. Instead, SharePoint often wraps files in a web-based viewer or forces a download experience through a redirect. Direct binary access means that your JavaScript (or browser) can fetch and process a file as raw binary data, not as an HTML-rendered preview or download link, but as a stream of bytes. For example, when you use:
const formPdfBytes = await fetch(formUrl).then(res => res.arrayBuffer()); ...you’re telling the browser to retrieve the raw PDF file so it can be manipulated (e.g., filled with pdf-lib). However, SharePoint typically prevents this by not allowing the browser to access the file as a pure binary stream. This is why SharePoint-hosted PDFs don’t work with libraries like pdf-lib. It’s not a hosting platform in the traditional sense.
I'd upload the PDF file to the Resources section and update the code to:
const formUrl = 'story_content/external_files/notes.pdf';
If this slide is run inside Rise as a Storyline block, it should work without any issues.
Related Content
- 10 months ago
- 4 months ago