<script type="text/javascript"> window.print(); window.onafterprint = () => alert("print dialog closed."); </script>