Automatic page breaks
When content exceeds the available space on a page, Forme automatically moves it to a new page. This happens at natural boundaries:- Between children of a View container
- Between rows of a Table
- Between lines of a Text block
Manual page breaks
Use<PageBreak /> to force content onto a new page:
breakBefore style property:
Non-breakable elements
Setwrap={false} on a View to prevent it from splitting across pages. If the element doesn’t fit on the current page, it moves entirely to the next page.
Fixed headers and footers
Use<Fixed> to repeat content on every page. Fixed elements reduce the available content area.
<Page> produces.
Dynamic page numbers
Use these placeholders in any<Text> element:
| Placeholder | Description |
|---|---|
{{pageNumber}} | Current page number (1-based) |
{{totalPages}} | Total number of pages in the document |
{{totalPages}} is always accurate. These are commonly used inside <Fixed> elements but work anywhere.
Table header repetition
When a table spans multiple pages, header rows (marked withheader) are automatically repeated at the top of each continuation page.
header and it repeats automatically.
Flex layout across page breaks
This is the core differentiator from other PDF tools. When a flex container splits across pages, Forme runs independent flex calculations for each page fragment. Consider a row layout with three items where the container splits after the second item:How it differs from react-pdf
react-pdf lays out content on an infinite vertical canvas and then slices it into pages. This causes several problems:- Flex breaks on page boundaries. A flex row that gets sliced has its distribution calculated for the full container, then cut in half. Both halves have wrong proportions.
- Tables break mid-row. Without page-aware row placement, a table row can be sliced between its top and bottom border.
- No header repetition. Since the table is just a set of rectangles on an infinite canvas, there is no concept of “repeat this row at the top of each page.”
- No post-split adjustment. After slicing, there is no second layout pass to fix the fragments. What you see is the result of a single layout pass on the wrong dimensions.