[FX.php List] [OFF] printable very wide table?

Andrew Denman adenman at tmea.org
Tue Dec 14 19:15:32 MST 2010


It sounds like you're on the right track.  Since browsers won't print the full horizontal dimension of the page if it's too large, you have to go to PDF, Excel/csv, or use tricks.

The one trick I came across that might work for you is breaking up the columns into separate page-width-size tables (height doesn't matter) and making the screen-only CSS render them as 'inline tables'.  This will make them appear on the screen next to each other instead of on top of each other, but when it prints they will be on top of each other and you get all of your data (you will want a CSS page-break after each table to make sure each one starts on a new page).  The only caveat to this is you must have a consistent row height and column width or the separate tables won't line up horizontally (row height) and columns could be cut off of pages (column width).

Andrew Denman

From: fx.php_list-bounces at mail.iviking.org [mailto:fx.php_list-bounces at mail.iviking.org] On Behalf Of Joel Shapiro
Sent: Tuesday, December 14, 2010 7:19 PM
To: FX.php Discussion List
Subject: Re: [FX.php List] [OFF] printable very wide table?

Hi Webko

I think we've got a mis-connect somewhere... ;-)

Let's take your example at http://apachescricket.com/table.php

It's clearly too wide to fit on one printed page, so I believe it would need to be broken down into a "list" of "sub-tables" so that it can print from a browser.  Since the columns in your example are so wide, we'd probably want to print just one column per page.  So my quest is to find the best way to print column1 on page1, col2 on p2, etc. -- and make sure that when all pages are printed, the user could line up the pages left to right and recreate the table.

Without reliable page-breaks, I don't think this is possible.  Maybe the CSS page-break-after will work here.  Otherwise, I'm back to creating PDFs.

Or tell me I'm still missing something :-)


On Dec 14, 2010, at 4:34 PM, Tim 'Webko' Booth wrote:

Dear Joel,

You're right about row height.  I hadn't expressed my concern well.  My concern really was printing the same rows consistently page after page without reliable page breaks.  I'm worried that if I try to 'fudge' page breaks by div height, then at some point a user might get rows 1-35 on pages 1-3, but then page 4 might be only rows 1-34 and then page 5 would be row 35, then a gap, & then rows 1-34-ish.  (Or is there something I'm not getting?)

As each row must be exactly the same height all the way across the page, no matter how wide, it should print reliably.

I hadn't known about the CSS page-break-after property, so that might be a good solution.

Then again... as I think about it even more...  I'm wondering now if a user's browser is set to "scale to fit", then if one page has fewer columns than another, might one page scale differently than other pages, or would all pages print at the same scaling per print job, regardless of indiv page widths?  (scaling differently probably *would* grow or shrink row height).  I'd hope each print job would be consistent across all pages, but is that something I can trust across browsers, OSes, and moving into the future?

It has to print each row at the same height - rows do not change heights halfway across or anything...

Of course, it wouldn;t take long to test this - except it looks like my browsers won't print a plain table to full width - I was trying to use http://apachescricket.com/table.php as an example, but it only wants to print Col1...


FX.php_List mailing list
FX.php_List at mail.iviking.org<mailto:FX.php_List at mail.iviking.org>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.iviking.org/pipermail/fx.php_list/attachments/20101214/d6b3fad5/attachment.html

More information about the FX.php_List mailing list