I have a document with a few sections and each section can be very varied as its very dynamic. The requirement is that each section if started on a particular page say for e.g. section 1 appears on page 1 and section 2 starts on this page below section 1 should appear on the same page if it can fit completely else it needs to go onto the next page. This is bcos a whole section(s) should appear on one page...Are there any things out there in CSS or XSLT which would od the trick. Any other ways also appreciated like any good PDF writers which would achieve this requirement.
+2
A:
Yes, a look at the page-break-before or page-break-after CSS properties.
You can force each section to start on a new page with page-break-before
:
.section { page-break-before:always; }
Or you can force any content that comes after a section onto a new page with page-break-after
:
.section { page-break-after:always; }
Chris Pebble
2009-09-30 14:34:21
+1 One more link: http://www.w3.org/TR/xsl11/#page-break-after
ATorras
2009-09-30 14:38:10
page-break-before is probably better, though.
brianary
2009-09-30 14:39:45
Good points, updating answer to include page-break-before as well.
Chris Pebble
2009-09-30 14:46:44
A:
or the page-break-before ;)
in the css: h1 {page-break-before:always}
that will cause the page to break when printing at each h1
JP Hellemons
2009-09-30 14:37:00
+1
A:
The best you can achieve with CSS is to force a page break between sections using the page-break-before or page-break-after properties. Note that either property will start every section on a new page, even if they could fit on the same page.
Martha
2009-09-30 14:48:10