How have I not used `#page1` before? Was able to p...
# advancedpdf
a
How have I not used
#page1
before? Was able to produce a separate first page header from the rest of the pages this way. No solution for 'print X only on last page' unfortunately yet, but it's more than I thought BFO could handle!
d
Currently we have
#page1
defined, and also
#page2
through
#page20
Do you know how to define an arbitrary number of pages? So one style for page 1, and a different style for all other pages
a
What I did was set the attributes on the body tag for pages 2 through N, and then used CSS to set the header and header-height for #page1. The trick is you need to have !important in the CSS to override the body tag.
👌 1
I did not come up with a way to do it without !important though
d
thanks
w
will you be able to know that it is the last page?
d
No, you can't know if you're on the last page in the freemarker template. This is because the freemarker only generates the content and hands it off to the BFO engine to generate the actual PDF. You can fake it with a lot of effort, normally by inferring how many pages your PDF will end up having by having a strict layout and counting how many transaction lines there are
Has anyone managed to get a dummy last page by using BFO's <https://bfo.com/products/report/docs/tags/tags/pdfset.html%7C&lt;pdfset>>?
w
what I am saying is you can force a last page if the content is different like a payment slip using <pbr macro-header=“last-page-macro”/> and assigning a different macro header
in fact you can force different pages using <pbr /> tag with different header by controlling the macro header
d
and just stick all the <pbr> elms at the end of the body? Seems like a nice solution, have you used it?
w
Yep, I used it a lot for requirements like Invoice statement with remittance slips (not showing the common header or different header) it’s perfect for those scenario most of the time
c
@wbermudo Can you elaborate on this? I need a remittance slip on an invoice and don't quite see how to do this from your notes above
w
let's say:
<pdf>
<head>
<macrolist>
<macro id="common-header">This is the header for all pages except remittance slip
</macro>
<macro id="remittance-slip">This is the header of your remittance slip
</macro>
</macrolist>
</head>
<body header="common-header">
The content of the Invoice here...
<pbr header="remittance-slip" />
This will show as another page, on your PDF. Where you can use it as  your remittance slip or like T&C pages. Note: You can also use <pdfset> to achieve this, but obviously there is a pros and cons doing that.
</body>
</pdf>
PBR tag forces another page on your output where you can control the header (see header attribute that reference a different macro id. Hope that helps..
c
Thanks, very clear!
w
you bet