在 IronPDF 中管理表头

Curtis Chau
Curtis Chau
Updated: 2026年4月22日

在处理跨多个 PDF 页面扩展的 HTML 表格时,确保表头在每个新页面的顶部重复是很重要的。 IronPDF的CssMediaType.Print选项促进了这种行为。

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

相反,使用CssMediaType.Screen将导致Chrome仅在表格的开头打印一次表头。

// 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;

有关处理分页和表格的更多示例和详细代码片段,您可以参考处理分页和表格的代码示例。

Curtis Chau 拥有卡尔顿大学的计算机科学学士学位,专注于前端开发,精通 Node.js、TypeScript、JavaScript 和 React。他热衷于打造直观且美观的用户界面,喜欢使用现代框架并创建结构良好、视觉吸引力强的手册。

阅读更多

准备开始了吗?

Nuget Downloads 21,916,531版本:2026.11刚刚发布