External HTML Object and JavaScript to create a PDF

rabano9900 Community Member Posts: 7

So I've read a couple of posts here in the forums about creating a pdf certificate/learning journal in Lectora, and I've kinda gotten the logic of how to go about it, but I think I've hit a wall.

Here's what I have right now:

Page 1: one question and an entry field, a "save" button, and a "view" button

Entry field details go into variable Entry001

Save button has an action that modifies a variable "Answer01" to be equal to Entry001.

view button goes to next page.

Page 2: shows text with the same question and a text box that, on page show, has its contents changed to Answer01. There's also a button called "Download to PDF".


Using jsPDF, I know I'm supposed to create an external html object that includes the .js files I need, and in the external html object, I write a function that:

- creates a pdf file

- brings the variable Answer01 into the pdf

- and then on the "Download PDF" button, I hook up an action that runs the function that I created to save the PDF.


How do I go about this? Has anybody had any luck generating something like this?