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.


Post a Comment

<< Home


View My Stats