I'm being able to print a HTML page to either PDF or MS Word. For the page footer, i'm using a CSS that set the page footer at the bottom of the page. It only works for 1 page only.
If i'm printing more than 1 pages, the footer will overlapped with data from first page.

How do i managed to set the page footer only printed at the bottom of the last page?

Here is my code:

<style type="text/css">
.footer  
{ position: absolute; bottom: 0px; left: 0px; width: 100%; } </style> <div class="body"> some page content..... ........... .......... ......... some page content.... </div> <div class="footer"> some footer notes...... </div>

with those codes, the page footer will only shown at the first page and it will overlapped with body content.

Any idea how to make my footer only printed at the bottom of the last pages (if my document contains more than one pages)?

Thanks for your kind help.

    a month later

    Hopefully commercial solutions are also ok for you, so give a try to our product PD4ML.

    PD4ML is a platform-independent tool/library written in Java, and it can be good integrated into PHP environment.

    In order to produce PDFs you need to create PHP/HTML the way you normally do and let PD4ML to convert it to PDF.

    Take a look to HOWTO document: http://pd4ml.com/php.htm
    There is a download link there with all the stuff you need to generate PDFs from PHP: environment test script, PD4ML library itself, demo PHPs.

    PD4ML allows to define footers (or headers) like that:

    <pd4ml:page.footer>
    <font color=red>Footer text. Page $[page] of $[total]</font>
    </pd4ml:page.footer>

    scope attribute allows you to set a page range the footer should appear on.

    scope="2+" or scope="odd" or scope="1,4-7"

    If you need the footer appearance only on the last page, probably <pd4ml:footnote noref>Footer text</pd4ml:footnote> tag
    at the end of the document content is even a better solution.

    Of course you may achieve the same result with absolute positioned elements (also supported by PD4ML), but the page footer and footnote tags turns the task into a trivial one.

      Write a Reply...