Managing Document Page Breaks
Overview
By default, document sections render immediately after one another. To prevent a section from being split across two pages or to start a new chapter, we apply a specific CSS class to the HTML source code of that section.
Let us understand with an Example
Objective
To move a section (e.g., "Order Summary") from the middle of a page to the start of the next page.
Instructions
1. Locate the Target Section
Navigate to your Doc Template record. Under the Related tab, find the Button Sections/Doc Sections list and click the Section Number you wish to move to a new page.
2. Access the HTML Source Editor
Once the specific Section record is open:
- Locate the header action buttons.
- Click Update HTML Content Source.
Note: Do not simply type in the standard text editor; you must use the "Source" update tool action button ‘Update HTML Content Source’ to modify the underlying code.
3. Apply the Page Break Class
In the pop-up window, you will see the HTML string. You need to identify the first container tag (usually <p> or <div>) and insert the page-break attribute.
- Standard Code: <p><strong>Order Summary</strong></p>
- Modified Code: <p class="page-break-before-always"><strong>Order Summary</strong></p>
Property | Value |
CSS Class | page-break-before-always |
Placement | Inside the opening bracket of the first tag. |
4. Save and Validate
- Click Next to confirm the change.
- Click Preview Document in the top menu.
- Verify that the content now begins on a new page in the PDF viewer.
Best Practices
- Avoid Redundancy: Only apply this class to the first element of a section.
- Table Consistency: If a section contains a large table, applying this class ensures the table header starts at the top of the page, improving readability.
Formatting Check: Always use the Preview function after a change to ensure the page break hasn't created unnecessary blank pages.