Tuesday, August 02, 2005

Printing page breaks using CSS

You can set page breaks using CSS. I used this when I needed to print a HTML report with 4-7 rows per record (Some records break over two pages, reducing readability). I checked the record count and inserted a page break every fifth record thus :

if ((i%5 == 0) && (i!= 0))
out.println("<tr class=\"breakhere\"><td></td></tr>");

The CSS for breakhere is:

page-break-before: always;

More here.

Hello World

This blog will contain code fragments/tricks I use while programming. Might also contain other geekery, who knows!?


View My Stats