Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


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

Posted on 2003-03-23
Medium Priority
Last Modified: 2010-04-06
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.
Question by:lyptus
  • 2
LVL 14

Accepted Solution

avner earned 300 total points
ID: 8194040
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.

Expert Comment

ID: 8194661
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.

LVL 12

Expert Comment

by:Dean OBrien
ID: 8194963
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!)


Expert Comment

ID: 8195824
(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.



Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most of the sites are being standardized with W3C Web Standards. W3C provides lot of web standard services to the web. They have the web specification, process and documentation for all the web standards. You can apply HTML, CSS and Accessibility st…
Without even knowing it, most of us are using web applications on a daily basis.  In fact, Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We generally confuse these web applications to…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
Suggested Courses

580 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question