Page 1 of 1
Giving Header to every page on print out
Posted: Tue Sep 07, 2010 8:11 am
by amplifire
Hello everyone!
I have developed this code in PHP and it generating reports.
My users print out the report and its working fine.
I want to ask if there is any way in which i could give header to the print outs on each page. I mean that now when the reports are being printed, the header is coming on only the first page of the print out. I want the header to be on all the p[ages of the print out.
Is there any way in which i could repeat the header when the page breaks during print?
Replies appreciated.
Thank you
Re: Giving Header to every page on print out
Posted: Tue Sep 07, 2010 6:46 pm
by mecha_godzilla
The way that print-outs appear is managed by the user's browser (IE it's client-side rather than server-side) so you might want to look at doing this with CSS - take a look at this tutorial to start with:
http://davidwalsh.name/css-page-breaks
The issues with this approach would be:
1. you'll need to find a way to incorporate the header into the page break code
2. if the page isn't naturally broken up into sections, the page breaks might end up in the wrong places
There's some more information about this here:
http://www.w3.org/TR/css3-page/
and here:
http://net.tutsplus.com/tutorials/html- ... -be-using/
Note that these techniques are reliant on CSS3 browser support so they may not be of much use to you.
The alternative is to generate everything as PDFs, which would give you complete control over the page structure.
HTH,
Mecha Godzilla
Re: Giving Header to every page on print out
Posted: Thu Sep 09, 2010 11:08 am
by amplifire
Thanx Mecha Godzilla for your good advice.
Your approach is very good, but as you said that it all depends on browser, so i came up with this thing up on internet
<thead> and<th>
So now i can create a huge table surrounding my page nad then give it a thead. thead is the table head section where i can use th element.
Now what it does is that when you will print you page out, no matter how long your page is, this header is going to repeat on every new page. And it is also supported by all major browsers.
So this way my work was done.
Thank you
Re: Giving Header to every page on print out
Posted: Thu Sep 09, 2010 4:44 pm
by mecha_godzilla
Interesting...I'll have to check that one out
I suspect this kind of solution has been ignored because no one 'does' tables anymore - at least, not for layout purposes.
Good luck with your site anyway,
M_G