Managing Table Headers in IronPDF

This article was translated from English: Does it need improvement?
Translated
View the article in English

When dealing with HTML tables that extend across multiple pages in a PDF, it's important to ensure that the table headers repeat at the top of each new page. IronPDF's CssMediaType.Print option facilitates this behavior.

// Set the CSS media type to 'Print' to ensure table headers repeat on every new page
Renderer.RenderingOptions.CssMediaType = IronPdf.Rendering.PdfCssMediaType.Print;
// Set the CSS media type to 'Print' to ensure table headers repeat on every new page
Renderer.RenderingOptions.CssMediaType = IronPdf.Rendering.PdfCssMediaType.Print;
' Set the CSS media type to 'Print' to ensure table headers repeat on every new page
Renderer.RenderingOptions.CssMediaType = IronPdf.Rendering.PdfCssMediaType.Print
$vbLabelText   $csharpLabel

By contrast, using CssMediaType.Screen will result in Chrome printing the table headers only once, at the very start of the table.

// Set the CSS media type to 'Screen' if you want the headers printed only once at the start of the table
Renderer.RenderingOptions.CssMediaType = IronPdf.Rendering.PdfCssMediaType.Screen;
// Set the CSS media type to 'Screen' if you want the headers printed only once at the start of the table
Renderer.RenderingOptions.CssMediaType = IronPdf.Rendering.PdfCssMediaType.Screen;
' Set the CSS media type to 'Screen' if you want the headers printed only once at the start of the table
Renderer.RenderingOptions.CssMediaType = IronPdf.Rendering.PdfCssMediaType.Screen
$vbLabelText   $csharpLabel

For more examples and detailed code snippets on handling page breaks and tables, you can refer to the code examples on handling page breaks and tables.

Curtis Chau
Escritor Técnico

Curtis Chau tiene una licenciatura en Ciencias de la Computación (Carleton University) y se especializa en el desarrollo front-end con experiencia en Node.js, TypeScript, JavaScript y React. Apasionado por crear interfaces de usuario intuitivas y estéticamente agradables, disfruta trabajando con frameworks modernos y creando manuales bien ...

Leer más
¿Listo para empezar?
Nuget Descargas 16,154,058 | Versión: 2025.11 recién lanzado