Forum How do I...?

Content copied from a <footer> element to an @page region only appears on the last page of the PDF

I am trying to copy the content of an element that exists inside the <footer> element of an HTML file into a @page region to make a running footer. However, the content only appears in the last page of the PDF file and not on every page as I expected.

Is there a restriction where only elements that are nested in the <main> HTML element can be pulled into an @page region on every page of the PDF and that content of elements in nested in the <footer> can only appear on the last page of the PDF?

I have not been able to solve the problem, but was able to create a different solution by pulling the string content from <meta> elements in the <head>. I need to make sure that the HTML file generates with the following meta elements:

<meta name="partno" content="301-6580">
<meta name="rev" content="A">
<meta name="month" content="June">
<meta name="year" content="2022">

Then, I can pull the strings from the content attributes in these <meta> elements with this code:

meta[name="partno"] { string-set: partno attr(content); }
meta[name="rev"] { string-set: rev attr(content); }
meta[name="month"] { string-set: month attr(content); }
meta[name="year"] { string-set: year attr(content); }

Then I can use those variables to generate the footer at the bottom of the page with this line:

@page {
@bottom {
content: string(assay-name) "\A" string(partno) " | Rev. " string(rev) " | " string(month) " " string(year);

There is one extra string in there pulled from elsewhere (assay-name) that is placed on the line above, with the \A creating a line break to put the other strings underneath.

Hello Mark, It seems you have found a good solution. If you still need help with the foodter element, could you attach an HTML file with an embedded style sheet which shows the problem?

Edited by howcome