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~~" +
var url = ("print.html?=" + header + args);,”_blank”,”width=800,height=600,menubar=no,scrollbars=yes”);

16 Replies
Glenn Jones

Hi Amy

I tried to figure this one out myself a while 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... 

Patty Brandt

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.

Eveline Holmes

Hi all

I'm having a look at this type of interaction, just to see how it would work for me.  I'm investigating note screens for users to take notes throughout a course and print them out at the end. I am trying out lightboxes and layers.

I used your code Eric as a guide and it worked perfectly - thanks so much.  The only issue is that the X obscures the player in the lightbox, so that wouldn't be a runner for me.  

Text not wrapping on PDF from Layers

I've tried it again using layers instead of light boxes but the issue I'm having is that the text isn't wrapping in the pdf, so I'm not getting all my notes. 

I have Googled and searched through these boards for an answer but haven't found anything.  I've no formal experience with coding, just mess around with it when I have to, so any help would be greatly appreciated.

Include a variable in the code to customise the title of the notes page

Another thing I would like to do is to adjust the code so instead of having the same standard text appearing at the top, I can customise it to add the session title.  I won't want to do this for each course so thought of assigning a variable "CourseName" to a textbox with the title in a template. 

I've tried to manipulate the code in various ways but can't get it to work. Again, any help would be appreciated.

I've added my storyline file in case that help.

Thanks in advance!