Forum Discussion

MarianneKoh-871's avatar
MarianneKoh-871
Community Member
2 years ago

Create a PDF form from responses with Articulate Storyline?

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?

    • JessicaAtterton's avatar
      JessicaAtterton
      Community Member

      Hi Joe, any chance you can explain this a little, it works perfectly on your slide, but i just copied and pasted the execute java for the pdf into mine and I can see I need to do something cos it showed a pdf but wasn't connected to my text fields. 

      • Joe_Dey's avatar
        Joe_Dey
        Community Member

        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);

  • Hi, Jessica!

    Joe might not be subscribed to this discussion, but you're welcome to contact them directly through their profile by clicking on their name and selecting Contact Me!