Hello everyone ! I want to change the content insi...
# advancedpdf
h
Hello everyone ! I want to change the content inside my header on the basis of page number of the pdf. I read the bfo user guide and found out the <pagenumber/> tag. But how do I get the value of this page number so I can add if else conditions according to it and change the header content?
d
Briefly, pagenumber isn't calculated until right before rendering, and isn't available to your freemarker template. You'll want to use bfo's header and footer macros. You can then specify which header macro to use based on the page number. This can be done explicitly on the body element and pgbr tags, or via the CSS (have a google for that). You infamously can't set a different header/footer for the "last" page. A well known limitation of the freemarker > BFO rendering pipeline
🙌 1
m
After you create your macro headers, then in your CSS: #page1 { header:nlheader; header-height:14%; } #page2, #page3, #page4, #page5, #page6 { header:nlheader2; header-height:12%; }
☝️ 2
s
Rule as above: You can do for first page, but not last
d
also, if you have arbitrarily long documents, you don't want to have to set
#page2, #page3, ... #page∞
. What you can do instead is set the header on the body tag (like:
<body header="nlheader2">
) and then only set page 1 to be different using the CSS
#page1 {header:nlheader}