Print PDF trigger/Javascript

Apr 26, 2017

Hi there,

Could anyone tell me how it's possible for when a user clicks a button in my course, that they are able to print say a given PDF file? (A pdf that is external to the course). 

So user clicks button > print dialog box appears with the PDF > then they can just press the print button on their computer.

Can anyone supply the javascript for this if needed? Sounds quite simple but I'm not too sure. Thanks a lot.

3 Replies
Walt Hamilton

I have a button labeled "Print Slides" with this trigger attached:

 

As long as the File: pane points to the location of the .pdf at the moment the module is published, the .pdf is packaged in the published file. When the user clicks the button, the .pdf opens in the browser (depending on the settings of their individual browser), and they can print it from there.

Walt Hamilton

It sounds like you may want to put the pdf  as an object on a slide or layer that prints when it opens.

Or, you could open the pdf, then have that same click pause so the document can load, then print. One simple way to pause is to show a layer that pauses the base timeline then hides itself when its own timeline completes.

As for the actual javascript, the forum is full of dozens of examples. Search here: http://www.articusearch.com/, or Tracy Carroll's post here might help you. I think the Articulate article (https://articulate.com/support/article/javascript-best-practices-and-examples-sl2) on best js practices may contain a code snippet to print.

This discussion is closed. You can start a new discussion or contact Articulate Support.