I'm trying to create a footer for my PDF file generated with HTML. I'm able to create a header that repeats for each page. Strangely enough, when I use the exact same technique to implement the footer, only the last page of the PDF has the footer. I'm doing it like this
@page{
size: a4 landscape;
@top-center {
content: element(header);
}
@bottom-center {
content: element(footer);
}
margin-top: 12em;
margin-bottom: 12em;
margin-left: 1em;
margin-right: 1em;
}
footer {
position: running(footer);
text-align: center;
padding: 5px 5px;
}
header{
position: running(header);
}
<footer>
Some text
</footer>
Is this a problem with CSS itself or the HTMLToPDF library I am using? I'm using openHTMLtoPDF Java library. Or is this a problem with me?
Making the running element the first element after the body tag solved the problem for me.