Forum Discussion

AmyNicholson's avatar
AmyNicholson
Community Member
9 years ago

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”);

26 Replies

  • Nedim's avatar
    Nedim
    Community Member

    Your code is fine as far as I can see on the screenshot (Step 3). Could be something else, maybe browser or device specific. Have you tried to run your project in different browsers? What device you are using to run your project? If you are willing to share your story file I'd be more than glad to test it out for you more in detail. 

  • Hi Nedim,

    Thank you so much for your quick response. I am attaching my Storyline file. Thank you for taking the time to check it out! I cut out the content to protect client content. You can access the notes via the navigation at the top of the player and the JavaScript is on slide 2.2. 

    Best,

    Kathy

    • kathrynbrown-2d's avatar
      kathrynbrown-2d
      Community Member

      Hi Nedim!

      Thank you so much for looking at and modifying the code! I so appreciate you taking your time to do that. It's what I love about the Articulate community - jump in and help for the greater good. Did you by chance publish it, and if so, did it work for you? I'm diving back in and going to check things out now, and crossing fingers it works!

      Best,

      Kathy

  • Nedim's avatar
    Nedim
    Community Member

    Sorry for late reply. Yes, it worked for me when I published it.