Forum Discussion
Print button - javascript
Hi, I would like to add a button that would allow the user to print the page. It seems like the easiest way would be to add a trigger to a button to execute javascript. Unfortunately, I know nothing of javascript. Can someone help me out with what need to goes into that script box?
Thank you!!
- ArturTrzebunia1Community Member
I believe the reason why Chrome and Firefox sometimes display a blank HTML page when invoking the window.print() function is because Storyline runs your project as a flash object on the PC/Mac. When you right click on the Flash object you can click "Print" to print that slide. So, is there a javascript command that will invoke the Print function from the Flash object's menu?
- ErikaPCommunity Member
Artur Trzebunia said:
I believe the reason why Chrome and Firefox sometimes display a blank HTML page when invoking the window.print() function is because Storyline runs your project as a flash object on the PC/Mac. When you right click on the Flash object you can click "Print" to print that slide. So, is there a javascript command that will invoke the Print function from the Flash object's menu?
I am also using Chrome and looking for the option to print from the Flash menu using a button/command. Any suggestions?- ZubeidaKudoosCommunity Member
I wasn't able to find a solution, but instead I created a button which opens a light box slide and explains to learners to right click on the slide and select the Print option...not sure if that work around is an option.
- JorgeLugoCommunity Member
Timothy, but it just work with the result page or we can use to print any slide?
- OmarWilkinsonCommunity Member
This in formation was great. I too know nothing aout Java scripts. I used the script and it printed the page. However, the button showed in the print. Is there away that I can put the button on another slide and enter a script to print a particular page or hide the button from printing?
- ErikaRomenesko1Community Member
Similar to Omar, I am looking for some code to take the text from the text entry (which is set to a variable (UserNotes) and print just that. Not the screen or any other buttons. Any suggestions or resources? Thanks!
- JesseSpinellaCommunity Member
Is there any more information on this topic anyone could link to or share? I'm also wondering about printable features within Java Script triggers.
- JesseSpinellaCommunity Member
Omar Wilkinson said:
This in formation was great. I too know nothing aout Java scripts. I used the script and it printed the page. However, the button showed in the print. Is there away that I can put the button on another slide and enter a script to print a particular page or hide the button from printing?
On page 1, I had the button link to a new slide with a trigger that says: Execute Javascript when the timeline starts. In the ... button I inputted the JavaScript print command. This avoids having to do anything funky with the Print Screen button. I ended up putting the variables and scoring page on a second slide that was 'printer friendly,' basically I created a new page with my own table.It'll print the page the moment the user clicks the Print button on page one.
- JesseSpinellaCommunity Member
Actually, correction, it printed the previous slide, not sure why. So, I just added a print button at the bottom of this page, simple fix. Doesn't get in the way of the table.
- CajiRCommunity Member
Thanks for the tip on window.print(); It worked for me. How can I get the window to automatically print in landscape orientation? What do I need to add to the JavaScript code?
- stevenrogersCommunity Member
Has anyone come across any problems using this with Chrome/Firefox? It seems to work fine every time through IE but randomly when I click the button the preview will come up blank, and print a blank page for both Chrome and Firefox even though it's the exact same course that is working in IE.
- GunjanKothariCommunity Member
@steven rogers, I have faced the same problem, and the reason was height of the page. You must give some height to your page to get the result in Print Preview / Print