Print button - javascript

Sep 14, 2012

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!!

69 Replies
Jesse Spinella

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.

Steve Flowers

To the question about not printing the "print me" button, you might try adding a trigger to hide the print button before calling the JavaScript to print the page. 

To the question about printing to landscape orientation - unfortunately, the browser interface through JavaScript doesn't offer any controls of the print dialog options. You can ask the browser to print the page but that's about it. There are some tricks you can run if you have some Flash authoring / ActionScript skills and access to Flash but short of that you're stuck either 1) asking the user to change the print settings to landscape or 2) living with the portrait default.

Grant Robertson

Hello again. I guess my question may not have been phrased in the best way, seeing as there have been no responses.

Are folks out there using Firefox and having success with the window.print() function from a Storyline course mounted on a website? When I run IE I get my printed page in portrait.

When I run Firefox (on a Windows 7, 64 bit system with the latest version of Flash [also taking away the protected mode] and Java), the page comes out blank.

Any clues about what I might do to make Firefox work for me?

Many thanks in anticipation.

Nancy Woinoski

Hi Grant - I have the same setup as you Windows 7, 64 bit and I just  created a little SL project that has a button with the javascript to print the page when clicked. It is nothing special but I published and tried running it locally using Firefox and it worked fine.

I tested it on Firefox version 15.0.1 and Firefox version 16.0.2 and it worked fine on both.

You say  the course is mounted on a website so I am wondering if it is a firewall issue.

I have uploaded the storyline file that I used. I know it works so try it and see if it works for you. If it doesn't then there is some issue with your browser configuration or your network security.

Grant Robertson

Hi Nancy, not at all a stupid question, but sadly, this is something that I had checked and yes, it is enabled. Still, unable to print the file you were able to print after quite a lot more time wasted.

In case others may have similar problems, what I have learned is that similar problems have been exprienced by others in the past both in Storyline (and this thread is an example) and also with Firefox and all sorts of programs more generally. It has to do with Firefox usually not liking to print windows via flash apparently. In fact, there is a public, unallocated bugfix request (and a whole lot of duplicate requests) for the Firefox team that goes back to 2002! Much teeth gnashing in the Firefox and other forums about this.

My work-around will be simply to warn users that the print feature works in IE but is not guaranteed to work in Firefox. I'll add ablank pdf to the Resources section which they could print out if the auto-print I've set up (and which works in IE) fails them.

Thanks again Nancy for your very kind and prompt support.

Val Ceolin

I was having the same problem Caji. 

I reduced my certificate to the side where I can see the printed and after that my French version of the course is working. However, to the English version, even using the same story file and only changing the text to English, when I print the page, the certificate is being squeezed. :( 

I only need to know how to print one slide to have a perfect course. Any ideas to solve this problem?

PS: My LMS works only on IE browser 7, 8 and 9.

Christine Hendrickson

Hi Val,

Though this method isn't supported by Articulate, it might be something you'd like to try for customizing the printed results. Please note that it's for Quizmaker, but this will work for Storyline, as well.

If that doesn't help with the formatting, or isn't what you're trying to do, can you give a little more information about what you'd like to show when printing the results from your course? Or how the text is displaying when you change it to English (try to provide a screenshot, of the changes if you can)?

Thanks!

Christine