Printing User Input to a PDF
Greetings -
I've seen multiple threads on this, tried one (it did not work).
Anyone know if I can allow the user to print their text input?
So, I have an activity with a number of text input areas. At the end I would like to provide a print results button that, when clicked, will take all of the user inputs (held in a number of variables), open a new window and dispay the user text in a PDF.
I have taken this JavaScript (from someone else's solution, which did not work for me) and put it on a button (execute JavaScript when clicked). I have also included two files that I was told to, a print.html, and a logo.png in the folder main output folder.
I know little of JavaScript, any help is appreciated.
JavaScript is:
var player = GetPlayer();
var header = "CL700 Mod 3 Free Online Research~~"
var args =(
"Question 1~~" +
player.GetVar("Q1") +
"~~Question 2~~" +
player.GetVar("Q2") +
"~~Question 3~~" +
player.GetVar("Q3")
)
var url = ("print.html?=" + header + args);
window.open(url,”_blank”,”width=800,height=600,menubar=no,scrollbars=yes”);
12 Replies
Hi Amy
I tried to figure this one out myself a while ago....best solution I could find required the end user having some specific piece of software installed at their end - so I gave up!
I've found this today which talks about saving variables to a text file which gets saved locally - no idea if it's of any use to you...
https://community.articulate.com/discussions/articulate-storyline/recording-user-s-name-and-email-address#73694
Hi Amy,
I just finished making a relatively simple method for printing user inputs (which you can then "print to PDF."
I'll post this elsewhere too, but I just saw your questions and figured you might be able to use my sample file. Let me know if you have any questions.
I should mention, you have to publish the file to see how it works. The JavaScript doesn't function in the Storyline player preview.
Hi Glenn - Just seeing your post now - thank you for your feedback! Much appreciated. I will take a look.
Hi Eric -
Thank you for your posts! I'll play around later today ... I'll post the results, if it works for me or not. Best regards.
Amy
Eric, where is your JavaScript for this slide? The slide works great, and I'd like to use it, but I need to be able to adjust the code to allow for more variables.
Hi Tracy,
Storyline hides the Javascript inside of triggers.
(1) Double-click on the *Execute JavaScript* trigger.
[image: image.png]
(2) Click on the *[...] Button *next to *Script*
[image: image.png]
Let me know if you have any trouble adding more variables.
all best,
Eric
Hi all, I am wondering if you could help me figure out a problem I am having with a Storyline 360 interaction. I created a "cover page" activity and when done, I want the users to print their cover page to a PDF, which I am able to do with the Print button function. No problem there whatsoever. However, when I tested printing to a PDF on my desktop yesterday, the PDF print out looked perfect, but today when I printed my cover page to a PDF from my laptop, the PDF is distorted.
Patty, you can try exporting data to a PDF file instead of printing the slide to PDF: https://cluelabs.com/pdf-maker-elearning-widget.html
Thank you, Eric, for posting this! It's exactly what I needed!
Thanks Eric, this is super handy - any chance you know how I could include some images in my PDF to make it look a bit fancy? Or is there a way to use a PDF template for the header/footer parts??
Hi Celia. I stumbled across this article while looking for something else. This article from eLearning Brothers might answer your question if you are still interested.
https://blog.elearningbrothers.com/blog/6-steps-on-how-to-make-a-printable-results-page-in-articulate-storyline