Create single PDF document from Storyline text-entry responses

Jan 02, 2018

Hello, 

I am creating an interaction where the students in a class fill in some 10-15 text-entry fields with their notes.  And then I would like to have all the notes compiled in one PDF for the students to take at the end.  

I found a few great discussions:

https://community.articulate.com/discussions/articulate-storyline/saving-storyline-variables-to-a-pdf

But I'm having trouble getting it to work that way.  Also, I'm not advanced enough in Javascript.  

https://community.articulate.com/discussions/building-better-courses/user-notes-that-they-can-print-and-email

This one solves the same issue I have except it's for just Print or Email, and I want to send to PDF.  I may end up going with the Print or Email option, but I just wonder:  Has anyone figured out a way to convert multiple responses in Storyline to a single PDF?

 

 

45 Replies
Jillian Rae

Thanks Russell, your solution looks like exactly what I need if I can get it running. I'm just wondering if it'll work locally for users that don't have internet access? I know there are issues with javascript accessing the local filesystem so I just want to check before I spend too much time swearing at it! As far as I can see it's not accessing anything as the image is encoded and the pdf is created on the fly and presented as a downloadable file, am I right?

Russell Killips

Hi Jillian,

Sorry, this approach doesn't work well locally. It is possible to get it running locally but depends on which browser is used and its security settings. Security settings could be turned off but I cannot recommend doing that as this could lead to more computer troubles such as viruses, spyware, malware, etc.

Teresa Vanderpost

Hi Matthew, I realized this is three year old post, but it is awesome.  I finally tried to do this with your javascript, four questions with responses, and I replaced your items with my variable names and it worked almost lol!  Have a few questions if you don't mind. I kept your exercisenotes1 through 4 as I didn't see an impact to my script, but ensured I updated my variable name.

When they click my button to print, they get a window first showing the answers and then another print button up top of that page and it does work, but can we bypass this page and go straight to the print window from the browser?  Wondering if there is a reason we have to go to that one first.

Also, when I click my print button, I get my responses three timesin the window, I am assuming I have done something when I was trying to figure out what code to copy for my question 4 as you have 3, so I tried to figure out what part to copy for my fourth question.

Also the print button on the first page still shows on the printable page....

Just checking as I don't know javascript, I am just logically trying to change the appropriate text and figured I may have missed something....  

Hope you are still around to help.  Attached a few items.

Thanks for any help you can offer.

 

Just a little update, I just tried it again and now I am not getting double answers....but I am sure I did not change anything....

Lewis Masling

Hi Russell,

This code, the files and the videos have been very helpful in getting me started with a PDF download.

 

However, is there a way to adjust the size of the text from within the createbook.js file? 

I'm no javascript expert so just muddling my way through. I have text that is set in the storyline variable but is a little too long and wraps underneath, and overlays on the next line - smaller text on the same line would be ace!

Jörgen Rennemo

Hi Russel and thank you for your nice examples. Really helpful and I have already learned a lot. 

Is there any way to change the head in the pdf so it's different on the sides of the pdf? I mean the one that says "Organizational Excellence Specialists" I want to change it to questions for each side.

Russell Killips

Hello Jorgen,

Take a look at a previous reply to Sue. There I talk about the code inside of createbook.js

The Organizational Excellence Specialists is an image that is placed at the top of each page.

Line 4 is where the image is defined.

Line 10 is where the image is added to the top of page one.

Russell Killips

Hi,

The splitTextToSize function converts the long text into an array of lines. So instead of printing out the entire array at once, the trick is to print out each line of the array in a loop.

Inside the loop, you keep track of how many lines have been printed. When you have reached your Lines Per Page maximum, you add a new page and then reset your number of lines printed counter.

Take a look at the attached sample. It is currently set to print out 15 lines per page.

Graham Clark

I used the file provided by Teresa above and it worked perfectly. However, like Teresa, the PDF also included the "Create your document" (Print) button. Is there some way of selecting the Print button to create the PDF but not having the button appear in the actual PDF?

Graham Clark

I have Acrobat Pro DC on my iMac rather than Acrobat Reader. I wonder if that makes a difference? Or maybe Parallels Desktop is the problem. I guess we'll never know for sure. All I know is no matter which browser I use in macOS or Windows 10 I always end up with the Print button in my PDF. I guess I'll just have to cross my fingers and hope that whenever I use this particular piece of JavaScript users aren't seeing the Print button when they print their PDF. Thanks for your help, Russell.