有没有办法使用 NReco.Pdf Generator C# 在不同的页面上设置不同的 headers?

Is there a way to set different headers on different pages using NReco.Pdf Generator C#?

我们分别为 PDF Headers 和 Body 使用了不同的模板。 现在我们想要在不同的页面上使用不同的 Headers。 我们正在使用 NReco 将 HTML 转换为 PDF,版本为 1.1.12。

你可以使用这样的东西
现在你只需要将 class 设置为你的 headers parent 元素,就像我在此处所做的那样

打印 p1-header 添加 class p1,打印 p2-header 添加 class p2 到该特定页面上的容器

<header class="p1">
    // this p1-header will be visible only rest will hide
    <h1 class="p1-header">some text p1</h1>
    <h1 class="p2-header">some text p2</h1>
    <h1 class="p3-header">some text p3</h1>

</header>

.p1-header, .p2-header, .p3-header{
    display: none;
}

.p1 .p1-header{
    display: block; 
}
.p2 .p2-header{
    display: block; 
}
.p3 .p3-header{
    display: block; 
}