Printing HTML Landscape Using Print CSS File

I think one of the hidden gems of web applications is that you can mold your page for printing using a specific CSS file or printing.  I wrote post a while back Printable Web Page which covered using the CSS media attribute for your <link> reference.  The other day I was working on some reports that had some table cut off issues.  I discovered there are a couple approaches that you can take, including using fixed width (though you’d need to know your printer widths) or using landscape and percents for tables.  I chose to do the later. 

If you add the following to your CSS file used from printing, it will default the users printing to Landscape and remove the margins.  I set by tables to use a width of 100% or less to fit on the screen.

@page {
size:landscape;
margin:0;
}

No comments: