At 10:27 31/03/2005 +0000, you wrote:
Message-ID: <[EMAIL PROTECTED]>
From: "Ng Hwee Hwee" <[EMAIL PROTECTED]>
To: "PHP DB List" <php-db@lists.php.net>
Date: Thu, 31 Mar 2005 18:24:41 +0800
MIME-Version: 1.0
Content-Type: multipart/alternative;
        boundary="----=_NextPart_000_00CD_01C5361E.E80297D0"
Subject: Web Printing

Hi all,

i know i can print out a header and footer using HTML <thead> and <tfoot>. However, the <tfoot> doesn't always stay at the bottom of the page. For example, if the the last page only have 2 records, the <tfoot> will appear pretty high on the page.

i am wondering how can i use PHP to fix the position of my header and footer

PHP cannot help you here, it's the wrong tool for the job (it's a "hammer" not a "screwdriver" so to speak).
You need to (*must* !!!) use CSS to position and specify the height and dimensions of the thead and tfoot thus :



thead { display: table-header-group; position: absolute; top: 0; height: 36pt; width: 100%; }

tfoot {
        display: table-footer-group;
        position: absolute;
        bottom: 0;
        height: 36pt;
        width: 100%;
}

These should apply *reasonably* well to position your thead and tfoot row groups in the same place on each printed page (adjust as desired). You *cannot* use PHP to "guess" the height of the page areas reliably unless you are using a fixed pitch font such as a dot matrix line printer. And even then it's somewhat guesswork (I've done both).

But if we're assuming that you're users have laser printers you *must* use CSS to do the print layout, PHP "line height guessing" will not work for you.

Cheers - Neil

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to