Page Break - HTML to PDF Conversion
Add a page break just use:
<div style="page-break-before:always"> </div>
Some Brief Description:
CSS:
page-break-after : auto | always | avoid | left | right
page-break-before : auto | always | avoid | left | right
page-break-inside : auto | avoid
<div style="page-break-before:always"> </div>
Some Brief Description:
CSS:
page-break-after : auto | always | avoid | left | right
page-break-before : auto | always | avoid | left | right
page-break-inside : auto | avoid
- left forces one or two page breaks after the element so that the next page is formatted as a left page.
- right forces one or two page breaks after the element so that the next page is formatted as a right page.
- always as a mix of both
Example::
@media print {
h2 {
page-break-before: always;
}
h3, h4 {
page-break-after: avoid;
}
pre, blockquote {
page-break-inside: avoid;
}
}
This code snippet does 3 things:
- it forces a page-break before all h2 headings (perhaps h2 tags in your document are chapter titles that deserve a fresh page)
- it prevents page-breaks right after sub-headings because that looks odd
- it prevents page-breaks inside pre tags and block-level quotes
Comments
Post a Comment