Forum Discussion
Create single PDF document from Storyline text-entry responses
Hello,
I wanted to share this. I created this workbook for a client. When clicking on the print button, a pdf is created and downloaded. I used a javascript library called jsPDF.
Russell,
Thanks for this example. Unfortunately, running the javascript returns a cross-site error, since modern browsers block scripts that try to access a frame with a different origin. This can be turned off on individual browsers, but that's not a feasible solution for most end-users. Also, the only js included in this doesn't make it clear how someone is laying out their js using AS3's variables. This is what I see in the js button:
window.frames[0].frameElement.contentWindow.CreateBook();
Do you have an example of this project working with hosted content in the same domain and a clear example of where the "CreateBook()" method is defined?
- RussellKillips-6 years agoCommunity Member
Hello Peter,
I don't know why you would be getting any cross-site errors. This uses a Javascript Library called jsPDF that is available from here: https://mrrio.github.io/
The Code: window.frames[0].frameElement.contentWindow.CreateBook(); executes a the function called CreateBook() that is inside of the WebObject.
If you extract the provided example there is a folder called PDFBook. This folder is the WebObject. Inside of the folder there are 3 files. An index.html file, createbook.js file and the jspdf.min.js file.
The main file that you want to look at is createbook.js This is where the CreateBook function is.
You can open the createbook.js file in a text editor like notepad. However, I like to use a program called Sublime Text. https://www.sublimetext.com/