This example uses the addEventListener() method to attach a "beforeprint" event to the window object.

Try to print this document

Tip: Keyboard shortcuts, such as Ctrl+P sets the page to print.

Note: The beforeprint event is only supported in Internet Explorer and Firefox.