Forum Discussion
Create single PDF document from Storyline text-entry responses
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:
But I'm having trouble getting it to work that way. Also, I'm not advanced enough in Javascript.
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?
- JillianRaeCommunity Member
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?
- RussellKillips-Community Member
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.
- TeresaVanderposCommunity Member
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....
- JrgenRennemoCommunity Member
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.
- RussellKillips-Community Member
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.
- EswarkumarKanthCommunity Member
- RussellKillips-Community Member
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.
- EswarkumarKanthCommunity Member
- GrahamClark-cc8Community Member
Russell, I used your story file as is but I still got the print button when I printed my PDF. Please investigate and advise.
- RussellKillips-Community Member
It's working fine for me. Tested in both Microsoft Edge and Google Chrome.
I have attached a short video showing you that it's working for me.
- GrahamClark-cc8Community Member
Hi Russell. Thanks for the video. I tried again but I'm still getting the print button on my PDF. I'm on an iMac and I'm using Vivaldi browser. I'll try another browser and let you know.
- GrahamClark-cc8Community Member
- RussellKillips-Community Member
Sorry, I don't know what's different about your setup.
I fired up my MacBook Pro and tested in both FireFox and Safari and its working fine for me.
- GrahamClark-cc8Community Member
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.
- SandraAria-501bCommunity Member
- RussellKillips-Community Member
Hello Sandra,
The Organizational Excellence Specialist is an image.
Take a look at a previous reply to Sue Beck as it explains the code.
- SandraAria-501bCommunity Member
Thanks!
One more question. Can you please tell if there is any particular reason you have added background picture (png file) seperately? Its basically the same like background itself. THanks!