Forum Discussion
Saving Storyline Variables to a PDF
I've been using jsPDF in storyline for well over a year now. On my most recent project I've run into an issue where ONLY Text variables seem to work now. Using either Number or True/False variables seems to prevent the jsPDF from running at all. Has anyone else run into this issue and found a solution? I've tried everything I can think of: a brand new project file, newly made variables, new variable names, and no improvement. If I replace it with a 'Text' type variable it'll work just fine. I have to use number variables in my project, because the activity I made does math with the numbers.
Edit: I believe I figured this out. In order to get a numeric/number variable to display in the PDF, it MUST be added to a text string or a text-based varaible. So in the example, it takes the userScore variable and adds '%' to the end. Other numbers I've used I've added '$' to the beginning of the variable. I've also added a text-based variable like doc.text(20, 20, numericVariable + textVariable) This is - in my testing - a necessary step. You can't just doc.text(20, 20, userScore) where userScore is a Number variable from storyline.
- SherriSagers-ca2 years agoCommunity Member
Hi Daryl - I found another way to deal with number variables. In lines 6-9, I import the number variables from Storyline and then in lines 22-25, I convert them to string variables. I also found, like you, that the unconverted number variables completely stopped the PDF print function. Nothing would happen at all when I clicked the print button - until I converted the number variables to strings.