Multi-Page Content
The PDF Processing component provides options for generating multi-page content in PDF, preventing the page-split, and rendering page templates.
For more information on how to render multi-page content with the Drawing library, refer to its PDF output documentation.
Manual Page Breaking
To manually specify the page breaks, use the forcePageBreak
property. As a result, a page break, which matches the forcePageBreak
CSS selector, occurs before each element.
The following example demonstrates how to split the content into multiple pages.
Automatic Page Breaking
The PDF Processing component supports automatic page breaking. To automatically insert page breaks, set the paperSize
option. You will still be able to apply the forcePageBreak
configuration to manually specify the break points.
For more information, refer to the known limitations of the Drawing library and the PDF Export component.
Page Templates
When you request multi-page output through the forcePageBreak
or paperSize
options, you can additionally specify a pageTemplate
. The page template is inserted into each page before the output is produced and you can position it relatively to the page by using CSS.
Adding Page Numbers
To add sequential page numbers to your exported documents, define a pageTemplate and display the pageNum
and pageTotal
that can be obtained from the props
.
Preventing Page Breaking in Elements
To prevent specific elements from being split across pages, use the keepTogether
option. keepTogether
accepts CSS selectors that are passable to querySelector
.
All elements from the following example which have the "prevent-split"
CSS class are kept within the boundaries of the pages and their content is not split. If they fall on a margin, they will be moved to the next page.
For more information on existing issues in element behavior during page breaking, refer to the article about known limitations and browser support.