How to deal with page breaks when printing a large HTML table

<!DOCTYPE HTML> <html> <head> <meta http-equiv=”Content-Type” content=”text/html; charset=UTF-8″> <title>Test</title> <style type=”text/css”> table { page-break-inside:auto } tr { page-break-inside:avoid; page-break-after:auto } thead { display:table-header-group } tfoot { display:table-footer-group } </style> </head> <body> <table> <thead> <tr><th>heading</th></tr> </thead> <tfoot> <tr><td>notes</td></tr> </tfoot> <tbody> <tr> <td>x</td> </tr> <tr> <td>x</td> </tr> <!– 500 more rows –> <tr> <td>x</td> </tr> </tbody> </table> … Read more

Disabling browser print options (headers, footers, margins) from page?

The CSS standard enables some advanced formatting. There is a @page directive in CSS that enables some formatting that applies only to paged media (like paper). See http://www.w3.org/TR/1998/REC-CSS2-19980512/page.html. Downside is that behavior in different browsers is not consistent. Safari still does not support setting printer page margin at all, but all the other major browsers … Read more

Landscape printing from HTML

In your CSS you can set the @page property as shown below. @media print{@page {size: landscape}} The @page is part of CSS 2.1 specification however this size is not as highlighted by the answer to the question Is @Page { size:landscape} obsolete?: CSS 2.1 no longer specifies the size attribute. The current working draft for … Read more