| | |
Regarding Pagebreaks
Please support our HTML and CSS advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Oct 2008
Posts: 6
Reputation:
Solved Threads: 0
Hai,
I've read about "page-break-inside" style and it seems to be
exactly what I need. I am working on some report printings, and I need
specific table to be printed on following page if it does not fit in the
current one. Unfortunatelly, I cannot solve this issue... Does
page-break-inside not work? I have made some tests on IE 7.0 and it
simply does nothing. How should I use this style?... Here is my code:
<table style="page-break-inside:avoid;">
<tr>
<td align="center" valign="middle">31</td>
<td align="center" valign="middle">32</td>
<td align="center" valign="middle" id="cell3">33</td>
<td align="center" valign="middle" id="cell1">13</td>
</tr>
</table>
Can you help me?
Thank you very much!
Seetha
I've read about "page-break-inside" style and it seems to be
exactly what I need. I am working on some report printings, and I need
specific table to be printed on following page if it does not fit in the
current one. Unfortunatelly, I cannot solve this issue... Does
page-break-inside not work? I have made some tests on IE 7.0 and it
simply does nothing. How should I use this style?... Here is my code:
<table style="page-break-inside:avoid;">
<tr>
<td align="center" valign="middle">31</td>
<td align="center" valign="middle">32</td>
<td align="center" valign="middle" id="cell3">33</td>
<td align="center" valign="middle" id="cell1">13</td>
</tr>
</table>
Can you help me?
Thank you very much!
Seetha
•
•
Join Date: Sep 2004
Posts: 89
Reputation:
Solved Threads: 1
•
•
•
•
I need specific table to be printed on following page if it does not fit in the current one. Unfortunatelly, I cannot solve this issue... Does page-break-inside not work? I have made some tests on IE 7.0 and it simply does nothing. How should I use this style?
•
•
Join Date: Oct 2008
Posts: 6
Reputation:
Solved Threads: 0
Hai
Thanks for the support.
BUt Im creating dynamic tables. The tables are not fixed size. One page may contain two or more tables. That is not specified in the program code. I cannot set page break before or after the tables, If I set means each table will print in one page. I dont want like that. If the table is not fit to the page, automatically it should go to the next page. I am using pagebreakinside in CSS. But it is not working... Any other way.
Thanks
Seetha
Thanks for the support.
BUt Im creating dynamic tables. The tables are not fixed size. One page may contain two or more tables. That is not specified in the program code. I cannot set page break before or after the tables, If I set means each table will print in one page. I dont want like that. If the table is not fit to the page, automatically it should go to the next page. I am using pagebreakinside in CSS. But it is not working... Any other way.
Thanks
Seetha
•
•
Join Date: Feb 2007
Posts: 66
Reputation:
Solved Threads: 4
Hi,
dynamic width and dynamic number of tables is not possible, just as msaqib said, you have to make the decision about the page break before you put the style into css.
If you want to make both table width and page breaks dynamic, then you have to take a greater step, and make some calculation:
1. Define the width of the page
2. Define font size
3. Get approx. width of each character in that specific font size (width of i and width of w / 3 * 2).
4. Define the margins and paddings
5. Make calculation of the achieved width during page generation by:
counting characters, multiplying with average font-width, add margin and padding, set as achieved width of table.
Now prior to sending the whole stuff to the browser, you have to put the whole text into variables, so that you can calculate whether the next table fits in the space between the last table and the edge of the page.
If the table fits into the space, then put it there, else simply add a page break before the table.
This is a little complicated and takes time, but it's possible.
Good luck.
dynamic width and dynamic number of tables is not possible, just as msaqib said, you have to make the decision about the page break before you put the style into css.
If you want to make both table width and page breaks dynamic, then you have to take a greater step, and make some calculation:
1. Define the width of the page
2. Define font size
3. Get approx. width of each character in that specific font size (width of i and width of w / 3 * 2).
4. Define the margins and paddings
5. Make calculation of the achieved width during page generation by:
counting characters, multiplying with average font-width, add margin and padding, set as achieved width of table.
Now prior to sending the whole stuff to the browser, you have to put the whole text into variables, so that you can calculate whether the next table fits in the space between the last table and the edge of the page.
If the table fits into the space, then put it there, else simply add a page break before the table.
This is a little complicated and takes time, but it's possible.
Good luck.
•
•
Join Date: Nov 2008
Posts: 3
Reputation:
Solved Threads: 0
The tables are not fixed size. One page may contain two or more tables. That is not specified in the program code. I cannot set page break before or after the tables, If I set means each table will print in one page. I dont want like that. If the table is not fit to the page, automatically it should go to the next page. I am using pagebreakinside in CSS. But it is not working... Any other way.
Not all printers are created equally.
You are having problems because the printer is not controlled by either the web browser or the html code. It is controlled by the printer driver that came with the printer. This function (and its settings) belongs to the owner of the computer rendering the page, not to you.
Your code can not know in advance how many lines the printer attached to the user's system can put on a page, or how the printer will lay out a table. It will be different if a user with a different printer opens the page. Just like different screen resolutions, there are different printer pixel resolutions.
So all of the rules that apply to different screens (and their disadvantages) also apply to different printers. Not only can't you know where the printer will break a page, you can't even know how large the printed page is, in terms of how much content fits on a page.
To get all of a table (or multiple tables) onto a page, the user should select the parts he wants to print, and then use Print Selection on the printer dialog box.
You are having problems because the printer is not controlled by either the web browser or the html code. It is controlled by the printer driver that came with the printer. This function (and its settings) belongs to the owner of the computer rendering the page, not to you.
Your code can not know in advance how many lines the printer attached to the user's system can put on a page, or how the printer will lay out a table. It will be different if a user with a different printer opens the page. Just like different screen resolutions, there are different printer pixel resolutions.
So all of the rules that apply to different screens (and their disadvantages) also apply to different printers. Not only can't you know where the printer will break a page, you can't even know how large the printed page is, in terms of how much content fits on a page.
To get all of a table (or multiple tables) onto a page, the user should select the parts he wants to print, and then use Print Selection on the printer dialog box.
Daylight-saving time uses more gasoline
![]() |
Similar Threads
- Dynamic content and printer pages (PHP)
- Help me (Java)
- plz suggest (Java)
- Query regarding .css files. (HTML and CSS)
- PHP Parse Microsoft Excel htm (PHP)
Other Threads in the HTML and CSS Forum
- Previous Thread: I need help.
- Next Thread: Java applet behave as button link?
| Thread Tools | Search this Thread |
appointments asp background backgroundcolor beta browser bug calendar cart cgi code codeinjection corporateidentity css design development displayimageinsteadofflash dreamweaver emailmarketing epilepsy explorer firefox flash form format google griefers hackers hitcounter hover html ide ie7 ie8 iframe image images internet internetexplorer intranet iphone javascript jpeg layout macbook maps marketshare microsoft mozilla multimedia navigationbars news offshoreoutsourcingcompany opacity opera optimization pnginie6 positioning problem scroll seo shopping studio swf swf. textcolor timecolor titletags url urlseparatedwords visual visualization web webdevelopment webform website windows7






