Is it possible to make a "print" button?

Hello everyone, I’m a complete Hype newbie, so I tried to find an answer in the manual and the forums first. As I came up with no results, here’s my question.
I’d love to make some educational quizzes with Hype, for example gap texts. Would it be possible to let the students print their current text? So basically a “send current screen contents to printer” function?

Thanks in advance for your answer(s)
Anke

This script could work...

 window.print()
1 Like

Yes, you would run the following JavaScript 'on mouse click' when clicking a 'print button':

Select the button, click the 'Action Inspector' and create a Mouse Click action to Run a JavaScript, then paste that in. Some browsers are not very intelligent when printing, so it really comes down to the quality of the browser's print renderer.

1 Like

Thank you, I’ll try that. Seems easy enough :smile:

Greetings from Germany
Anke

1 Like

ok, but it's possible to use a css for print formatted page?

Not really as the print protocol is based on the browser. So all you are doing is passing the command to the browser to "open it’s print dialogue window"
There used to be some sketchy ways to do this with VBScript acting on an iFrame button for IE but Microsoft shut that down since it could be a security breach.

I think that would be a good idea to use the hype "layout"function to do a print size that uses a dedicated css (like this html tag type=“text/css” media=“print”). What do you think?

Try it out, that might be a neat application…and share :smile:

Hello.
I have a question. It posible use this script in a scene with images?

Just assign a click functionality to a image and then chose JavaScript. Enter the window.print() in an new function.

1 Like

Excellent, this script works perfect, thanks for your help Max, regards.

1 Like

I haven't used this for printing, so I'm not sure, but maybe CSS Media Queries is what you're looking for...

CSS Media Queries

1 Like

Pretty sure I used this in the past and it worked well.

The idea is to set specific styles when printing.

i.e

@media print { 
 
 .noShowPrint { display: none !important; } 
}
1 Like