Page breaks with all sections on one page

I have a document with several sections and each section can be very varied as it is very dynamic. The requirement is that each section, if launched on a specific page, says, for example, section 1 appears on page 1 and section 2 starts on this page, below section 1 must appear on the same page if it can completely match another that needs to go to the next page. It's bcos the whole section should appear on one page ... Are there any things in CSS or XSLT that would be tricked. Any other ways were also rated as any good PDF writers who would achieve this requirement.

+2


source to share


4 answers


Yes, see 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 the section to a new page with page-break-after

:

.section { page-break-after:always; }

      

+2


source


The best thing you can achieve with CSS is to force the page break between sections to use the page break or page break properties. Note that either property will start each section on a new page, even if they can fit on the same page.



+1


source


or a page break before;)

in css: h1 {page-break-before: always}

which will break the page when printed on every h1

0


source


FOP is a great tool (free) for creating PDF files. Inside FOP, you also have a property that can set page breaks:

keep-with-next.within-page="always"

      

0


source







All Articles