Forum Discussion

AmitGoel's avatar
AmitGoel
Community Member
7 years ago

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:

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?

 

 

  • JillianRae's avatar
    JillianRae
    Community 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-'s avatar
      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.

  • 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....

  • JrgenRennemo's avatar
    JrgenRennemo
    Community 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-'s avatar
      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.

  • Hi,

    If the variable value is more the Content will not split to the next page. Is there any solution of this? Please help me on this issue. I attached one screenshot for reference. Please check once.

    Thank You

    • RussellKillips-'s avatar
      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.

      • EswarkumarKanth's avatar
        EswarkumarKanth
        Community Member

        Hi Russell Killips,

        Thanks for giving this sample zip file.

        When i checked in output the PDF file is not generated. Please check the attached screenshot and give me the solution once. Thanks in advance.

    • RussellKillips-'s avatar
      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-cc8's avatar
        GrahamClark-cc8
        Community 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.

    • RussellKillips-'s avatar
      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.

  • 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.

  • Hi Russell,

    Great interaction. I managed to download the PDF when I insert it to my Rise course. I have question about the PDF. Is the upper part editable - Organizational Excellence Specialist. Can I somehow edit this part?

    • RussellKillips-'s avatar
      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-501b's avatar
        SandraAria-501b
        Community 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!