There is an invoice preview webpage. I want to set header and footer information off while printing it. I know we can edit the page setup settings. But I wanted to know if we can do something without changing the default page setup settings. With default setting inside page setup, webpage title and webpage path are displayed for header and footer respectively.

Thanks

.header { width: /* etc */ }
.footer { /* bla bla */ }
.printheader { width: /* etc */ }
.printfooter { /* bla bla */ }
@media print { 
.header {display:none;}
.footer { display:none; }
.printfooter {display:block;}
.printheader {display:block;} 
}
@media screen { 
.header {display:block;}
.footer { display:block; }
.printfooter {display:none;}
.printheader {display:none;} 
}

segments of css, defines headers and footers for print or screen and toggles between which ones are displayed depending on output, great for including copyright messages on printed version of the page

@media print {.header {display:none;}
.footer{display:none;}}

simple version just hides class='header' and class='footer' when printing

ignore above, misinterpreted question,

This is not possible, PHP cannot have any influence over the print settings. The best you can do is supply a print stylesheet to change the appearance of a page.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.