Printing User Input to a PDF
Aug 31, 2017
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
Sorry for late reply. Yes, it worked for me when I published it.