Fog Creek Software
g
Discussion Board




Printer-friendly with tabular data

I've built a website that lists jobs for my company.  The HR dept. now wants to be able to print the result set of current jobs.  I am using ASP.NET, and I've been toying around with various web controls (datagrid, datalist, repeater) trying to find a suitable one. 

I would like to build this to print on a standard piece of paper (8.5x11).  I need to calculate the number of pages needed, and do some custom paging based on that.  Anyone know how to create a nice, printer-friendly version of a web page that has lots of tabular data, each row containing a different number of lines?  (job descriptions vary...) 

Thanks!

nathan
Friday, December 5, 2003

Don't try and calculate paging; wrap each job in a div:

<div class="job">job html here</div>

and then in a stylesheet with media="print" do:

.job { page-break-before: always }

Most modern browsers (IE6, Opera 7, NS 7) will do the page breaks when the web page is printed. 

For your tablular data just set width="100%" (no pixel, etc. settings).  Please, save yourself the hassle.

steved
Friday, December 5, 2003

thanks steved.  exactly what I was looking for.  in case anyone is wondering, i'm using the repeater control to display each job, wrapped in a div tag like steved said.  looks beautiful!

nathan
Monday, December 8, 2003

*  Recent Topics

*  Fog Creek Home