Print a web page so tables don't get cut off.

I have a web page that displays a dynamic table.  The table is repeated based on the number of records returned by the querry.  This number could be different each time.  Each dynamic table will also have different heights.  I want to be able to print all the tables with out part of one being on the bottom of one page and the rest printing on the top of the other.  So, if 2 tables will fit completly on the first page but the third will not it will move that one to the next page.  That next page will then print as many tables it can on that page.  This could be 1, 2, or 5.  I have searched for javascript code and vbscript but have been unsuccessful.  Does anyone know how to do this? Is it even possible.
Thanks.
lyptusAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

avnerCommented:
Cannot be done, you can never know what wuld be the user's setting for the printer.

What you can do is :
1. Add <br style="page-break-after:always"/>
This will force a page break.
2. Generate a PDF which is the only 100% safest way for Web printing.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ladweinCommented:
See http://www.rustyparts.com/pdf.php

With example3 you can generate a pdf File from what is currently displayed in the browser.

Look also in the forum.

0
Dean OBrienCommented:
Just a thought, could you not print out individual <div>'s, store each of you new tables in div1, div2, div3, etc then have some sort of function that checked at the number of records in each table, i.e. table 1 has 13 records, table 2 has 8 records and only 20 fit on a page, then you know to print each them separate.  (Not very clear i know!)

0
ladweinCommented:
(to easynow111)
As avner stated before: You never know the user's printer settings. So you cannot tell how many table rows will fit on one page.

Besides temporary PDFs have a lot of advantages:

- The user can save the displayed webpage without loosing pictures or links.
- There is a printing preview
- If the output does not fit on one page, the user can chose which pages to print
- The user can print parts of pages.

...




0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Languages and Standards

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.