The print method of the window object is used to open the print dialog so that the user can configure the print job and then print the page.
Javascript CODE EXAMPLE
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
function printPage() {
window.print();
}
</script>
</head>
<body>
<button onclick="printPage()">Print Page</button>
<h2>My Page Heading</h2>
<p>My paragraph content...</p>
</body>
</html>