To try out the afterprint event, click the link below to open the window to print. You can also try changing the code to use beforeprint to see the difference.
afterprint
beforeprint
Open Popup Window