Forum Discussion
PDF Publishable Certification Checklist
Ideally, you would do this using a survey tool, or your LMS may already have this capability. But if you want to do it within Storyline, I have prepared a .story file using Stephanie's example that demonstrates one way of doing so:
https://360.articulate.com/review/content/e25446f9-892b-4efd-8c04-fcfc6f6434f3/review
Attached is the .story file and template PDF.
The JavaScript to generate the PDF uses the library documented here:
https://pdf-lib.js.org/docs/api/
Review John Cooper's post in this thread for moving variable values to a PDF using that library: https://community.articulate.com/discussions/articulate-storyline/creating-downloadable-pdf-files-in-storyline-an-update-on-earlier-methods
Unlike some other JavaScript with Storyline, the PDF generation will not work unless you put the published output on the web, such as your LMS or Articulate Review (that is, it won't run when published to your local drive).
The JavaScript executed via the button on the last slide of the .story communicates with a PDF form (created with Adobe Acrobat) with placeholders for variable values. After publishing, you need to put this PDF (attached to this message) alongside story.html. So for example, if you're going to test your project on Articulate Review, use the Publish > Review 360 > "Publish locally for manual upload" option and, after publishing, add the PDF to the zip that was created during the publishing process.
For a checklist with 200+ questions, you'll need to spend a lot of time creating the variables in Storyline, adding the triggers, and adding the lines in the Execute JavaScript trigger. You will also need to spend some time in Acrobat constructing the PDF with the corresponding variable placeholders.
Once you understand the demo .story file and JavaScript, as well as the PDF template, you should find this isn't all that difficult, but it will require a lot of labor if you have a lot of statements in your checklist.
Hope that gets you started!
Thank you for taking the time to share this example, Steve!
I have a use case for this. In sections throughout the final PDF output (and the Storyline file), course participants may check a box to indicate "Yes" with the selected state of the box. If the box is left unchecked or in its default/normal state, the assumption is the answer is "No." For example, if a question were, "Which tool(s) do you use?" a participant would select a box only if they used the tool.
_ Scissors
_ Exacto knife
_ Paper cutter
I have assigned two values to the checkbox variables in my Storyline file: 0 (default), if state is Normal, or 1, if the state is Selected.
In the '//Check selected checkboxes in PDF" section of the JavaScript code, is the else section needed? If so, how would I modify the code for this situation? Here's what I have tried without success (else statement removed, where check2a was the JavaScript string name assigned to the Storyline variable name and Box2a is the JavaScript string name assigned to the PDF field name).
if (check2A == 1) {
Box2a.check();
}
if (check2B == 1) {
Box2b.check();
}
My version of the JavaScript without the checkboxes and only TextEntry fields prints as expected across multiple slides and PDF output pages. The only thing I need to solve are the checkboxes. I'd appreciate any help with this!