This example uses the addEventListener() method to attach a "beforeprint" event to the window object.
Tip: Keyboard shortcuts, such as Ctrl+P sets the page to print.
Note: The beforeprint event is only supported in Internet Explorer and Firefox.