Forum Moderators: not2easy

Message Too Old, No Replies

Pagination

how to force a page break in printed report

         

Mr Bo Jangles

5:04 am on Mar 11, 2007 (gmt 0)

10+ Year Member



Hi all,
Is there any way, CSS, or javascript, or anything, that I can ensure a html print job will break to a new page where I want it to?
My dynamic html reports are table based.

penders

2:41 pm on Mar 11, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



The CSS properties
page-break-before:always
and
page-break-after:always
can help here to force a page break before or after an element. Which I believe are OK cross-browser. There is also
page-break-inside
,
orphans
and
widows
- but I'm not sure on current browser support? Anyone?

I would, however, try to avoid forcing a page-break mid table.

W3C:
[w3.org...]

Mr Bo Jangles

3:35 pm on Mar 11, 2007 (gmt 0)

10+ Year Member



thank you, that was very helpful.

cmarshall

4:43 pm on Mar 11, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I have never gotten the CSS page-break properties to work on any browser except Adobe Acrobat (Web-to-PDF converter).

Maybe the never crop of browsers will be better at supporting it. I'll have to check...

penders

7:00 pm on Mar 11, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I have never gotten the CSS page-break properties to work on any browser except Adobe Acrobat...

How long ago was that then? :) The popular browsers have at least supported the basic

page-break-before
and
page-break-after
properties for quite a while. I imagine though you could get problems if you are trying to page-break inside nested elements, tables and positioned elements?

I had a dabble with page-breaks quite a while back and ran a few tests... the browsers did at times vary it what they produced, but the following did at least produce 3 separate pages on FF1.0, Opera7 and IE5 at the time (it was a while ago!)...

<p style="page-break-after:always;">Page 1</p> 
<p style="page-break-after:always;">Page 2</p>
<p>Page 3</p>

cmarshall

7:51 pm on Mar 11, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It wasn't that long ago.

However, I always had my page breaks inside of elements, as I usually do the XHTML 1.1 thing, which requires containers up the yin-yang.

Maybe I need to close the main page containers, do a page break, then reopen them. What a pain.