I have a document in HTML and CSS. I would like to have headers and footers in every printed page so that when you press Print, each page has the same footer and header. Is there a way to do this using web technologies? I can't find much information on printing besides page-break-after and so on.
This is what I found out: You can use However, fixed positioning also means that any content you have there may go behind the fixed positioned element. So, in effect, the header and the footer does not occupy any space. You can't control the actual header/footer (e.g. the URL that is printed). The user has to disable those himself/herself. The best alternative to painful HTML/CSS printing is PDF. You can control how each page look like, what's the size of them and header/footer. The drawbacks are slower prints (generating PDF is not as fast as loading a HTML page) and the pain of working your way with some PDF library. |
|||||
|
You CAN'T set the header and footer, it's the browser which handles that part. |
|||||
|
display:none
for those divs; (4) in print stylesheet, setdisplay:block
. – Aleks G Jul 12 '11 at 13:20