2

I'm writing a utility which dynamically generates an HTML page in a certain document structure. The body consists of a number of div's stacked on top of each other, each holding certain content (as a sort of list). Each of these content div's may be a variable height, especially depending on how wide the printer page is.

Here's a sample of the produced HTML:

<html>
<head>
  <title>Page Title</title>
  <style>
    (Dynamically generated styles)
  </style>
</head>
<body>
  <div id="divMain">
    <div id="divHeader">
      <div id="divTitle">Page Title</div>
      <div id="divSubTitle">Subtitle</div>
    </div>
    <div id="divContent">
      (Dynamically generated content div's)
    </div>
  </div>
</body>
</html>

This page is only plain HTML with CSS, and needs to work when a user double-clicks on this HTML file on their own computer, not hosted from a site. Therefore, there is no script in this page.

Now, once I have produced this HTML, my intention is to print it (or save as PDF). When it's printed, each printed page needs to have a custom header and footer inserted. As mentioned above, each content div could be any variable height, and could change if the printing width changes.

How do I insert my own header/footer into each printed page?

Charles
  • 50,943
  • 13
  • 104
  • 142
Jerry Dodge
  • 26,858
  • 31
  • 155
  • 327
  • 1
    and http://stackoverflow.com/questions/1722437/is-there-a-way-to-get-a-web-page-header-footer-printed-on-every-page?rq=1 – Natrium Mar 29 '13 at 14:39

0 Answers0