Add Classic Text Headers & Footers
IronPDF for Python makes it easy to add consistent text-based headers and footers to every page of a rendered PDF using the TextHeader and TextFooter properties of RenderingOptions.
Getting Started
Configure TextHeader and TextFooter on a ChromePdfRenderer instance before rendering. Set MarginTop and MarginBottom to create enough space so the headers and footers do not overlap the page content.
Understanding the Code
TextHeader: ATextHeaderFooterobject that configures the header appearing at the top of every page.TextFooter: ATextHeaderFooterobject that configures the footer appearing at the bottom of every page.DrawDividerLine: WhenTrue, draws a horizontal line separating the header or footer from the page body.CenterText: The text displayed in the center position. Supports dynamic merge fields.LeftText/RightText: Text aligned to the left and right of the header or footer area.Font/FontSize: Controls the typeface and size of the header/footer text.MarginTop/MarginBottom: Page margins in millimeters. Increase these to reserve space for headers and footers.FirstPageNumber: The starting page number. Set to2when a cover page will be prepended to the document.
Dynamic Merge Fields
The following tokens are replaced with live values at render time:
{page} {total-pages} {url} {date} {time} {html-title} {pdf-title}
Learn to add headers and footers to PDFs with IronPDF for Python!
Related Docs Links
Ready to Get Started?
Version: 2026.6 just released
Still Scrolling?
Want proof fast?
run a sample watch your HTML become a PDF.






