Use the HTML DOM to assign an "onafterprint" event to a body element.
Tip: The keyboard shortcut Ctrl+P prints a page.