Headers/Footers and Page Breaks
Page breaks can be confusing.
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
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
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