I want to print the page on button click without opening a new tab.
I have a following lines of code that does the job for me.
function PrintDiv() {
You need to have a print based CSS style rule - you can also set other print based rules - such as document size, background color , image specs etc:
@media print { #button-container{ display: none; } }