Level 52
Hello
window.print() prints only the current page.
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
i use this button and this script to print report with many pages but it print only one page
<button onclick="printpage();" id="printpagebutton" class="print-button" type="button"> <span class="print-icon"> </button>
<script>
function printpage() {
//Get the print button and put it into a variable
var printButton = document.getElementById("printpagebutton");
//Set the print button visibility to 'hidden'
printButton.style.visibility = 'hidden';
//Print the page content
window.print()
printButton.style.visibility = 'visible';
}
</script>
Please or to participate in this conversation.