<!DOCTYPE html>
<html lang="en-US">
<body onafterprint="myFunction()">
<h2>Try to Print this page</h2>
<p><strong>Tips</strong> : <br>Windows - Ctrl + P<br>Mac - Cmd + P</p>
<script>
function myFunction() {
alert("This document is now being printed");
}
</script> </body>
</html>