I'm using a HTML to PDF Library called Nreco to convert HTML Pages to PDF. The task includes setting the same header on every page, apart from the first page which contains the Recipient Address as part of the header.
I'm wondering what is the best way to make it possible. The Nreco C# library allows setting a Document wide header that remains the same depending on every page.
I'm a HTML/CSS amateur. My thinking is: it should be possible somehow (conditional statement) to add the Recipient Address only on the first header, and omit it on every other header instance. However, I can't find a way to access the page counter in the header code, also there is no option to specify a conditional operator inside the HTML/CSS.
Code:
<td colspan="4" rowspan="11" width="100%" class="textTopLeft">
<p>
{billingRecipient1}
<br>
{billingRecipient2}
<br>
{billingRecipient3}
<br>
{billingRecipient4}
</p>
</td>
I found a solution.
I wrapped my block in a div called headerStyle. Then added an ID to my inner block called dynamicSection. After this I added this script to hide the dynamicSection block on any pages apart from the first one.
var y = document.getElementsByClassName('headerStyle');
for (var j = 0; j < y.length; j++) {
if (vars[x[2]] != 1) {
document.getElementById('dynamicSection').style.cssText = 'display: none;';
}
}
Hope this helps someone out!