Headers/Footers and Page Breaks

Page breaks can be confusing.

The page-break-after CSS will always work if applied correctly. If your style sheet changes a div to not be display:block the rule cannot work. Apply at a block level element (div) ideally directly a child of the body tag

If your headers and footers are not being displayed as expected across page breaks, please follow these steps:

1. Simplify the issue

If your content is variable length, first use test content of variable lengths, to check you are using the correct Html/CSS. A good tool is is https://www.lipsum.com/

2. Validate your HTML and CSS

CSS Validator https://jigsaw.w3.org/css-validator/validator.html.en#validate_by_input

HTML Validator https://validator.w3.org/#validate_by_input

You may need to ask your web designer to help perfect your HTML, while tracking changes.

The positioning of disclosure will be about table structure, tfoot, and many other factors.

3. Check the output in Chrome's Print Preview

IronPDF will output an identical PDF to the desktop Chrome web browser.

This may require trial-and-error to get your HTML correct, but is a quick and easy way of debugging your input in Chrome first before sending to IronPDF, which will render identical to Chrome.

Using File >> Print >> Save as PDF, with the default options

Basic Guide: https://ironpdf.com/troubleshooting/pixel-perfect-html-formatting/

Full Tutorial: https://ironpdf.com/tutorials/pixel-perfect-html-to-pdf/

4. Use the Chrome developer tools

Use Inspect in the Chrome developer tools to look for calculated final CSS in elements

5. Render the HTML using IronPDF

Once the output in Chrome is as you expect, send to the IronPdf.ChromePdfRenderer to create your pixel-perfect PDF