Click or drag to resize
Pdf Library for .NET
Page Breaks

By default, the html to pdf converter offered by Select.Pdf Library automatically pages the content. There are 2 properties that can be used to customize the content pagination:

  • KeepTextsTogether - This property instructs the converter whether to try to avoid cutting off the text lines between pdf pages or not. The default value for this property is True.

  • KeepImagesTogether - This property instructs the converter whether to try to avoid cutting off the images between pdf pages or not. Due to the fact that images could be large and avoiding cutting them would great large gaps in the pdf pages, the default value for this property is False.

Manual Paging

Content pagination can be controlled from HTML/CSS. CSS styles can be used to manually change the pagination:

page-break-before: always

The "page-break-before" property sets whether a page break should occur BEFORE a specified element. The element can be anything (image, table, table row, div, text, etc).

<div style="page-break-before: always">
A page break will be inserted BEFORE this div element because "page-break-before" property is set to "always".
</div>

page-break-after: always

The "page-break-after" property sets whether a page break should occur AFTER a specified element. The element can be anything (image, table, table row, div, text, etc).

<div style="page-break-after: always">
A page break will be inserted AFTER this div element because "page-break-after" property is set to "always".
</div>

page-break-inside: avoid

The "page-break-inside" property sets whether a page break is allowed INSIDE a specified element. The element can be anything (image, table, table row, div, text, etc).

<div style="page-break-inside: avoid">
The content of this div element will not be split into several pages (if possible) because "page-break-inside" property is set to "avoid".
</div>
See Also