Create a PDF form from responses with Articulate Storyline?

May 12, 2023

Hi - I've seen something along these lines posted on the discussion boards but straightforward response. The goal is to have a few questions throughout that learners respond to and at the end, all their responses are consolidated into a downloadable PDF document that they can use as reference or reflection. I'm wondering if anyone has come up with a simple solution yet? Can anyone share a storyline template that already has this function built in that can easily modified and simple instructions so those of us who do not know javascript can use it as quick hack?

4 Replies
Joe Dey

Hi Jessica, here is your fixed code. To add new lines just copy what I have done in bold and change the numbers in Step 1 and 2 and the answer title in Step 2.

// Step 1. Connect JavaScript to the Storyline variables
var player = GetPlayer();
var textEntry1=player.GetVar("answerOne");
var textEntry2=player.GetVar("answerTwo");
var textEntry3=player.GetVar("answerThree");


// Step 2. The HTML Section - with the Storyline variables inserted
var contents = "<html><head></head><body style='width:650px;padding:20px;'>";
contents+="<div style='font-size:26px;font-weight:bold;margin-top:26px;margin-bottom:20px;'>Print or save as PDF</div>";
contents+="<div style='display:block;border-width:1px';><hr/></div>";


contents+="<div style='font-size:16px;font-weight:bold;'>Barriers</div>";
contents+="<p>"+textEntry1+"</p>";
contents+="<div style='font-size:16px;font-weight:bold;'>Managing Things</div>";
contents+="<p>"+textEntry2+"</p>";
contents+="<div style='font-size:16px;font-weight:bold;'>Answer Title</div>";
contents+="<p>"+textEntry3+"</p>";
contents+= "</body></html>";

// Step 3. Open the document window, write the HTML contents, and open the print window
var myWindow = window.open("","Print","width=810,height=900,scrollbars=1,resizable=1");
myWindow.document.write(contents);