Is there a good way (or any way) to get breadcrumb...
# advancedpdf
e
Is there a good way (or any way) to get breadcrumbs to print in a header of an Advanced PDF. For example, if printing a number of records similar to a dictionary, and you want to print the first word appearing on this page on the top of the page (and possibly the last as well). Example:
p1
Apple - Bar
apple: …..
artist: …..
bar: …..
p2
Board - Cube
board: …..
brisket: ….
cube: ….
I was thinking of storing the first label (Apple, Board) in a variable, and referencing the variable in the macro for the header, but this doesn’t work…
s
The tricky part is that pagination is really only a feature of BFO. Freemarker does not even know that the template being used will be multi-page or not. It could just as easily be a single page HTML output instead of a PDF. So, the only way to make it work is to set a limit for the # of record per page, and forcibly page break every so often with a pbr tag (https://bfo.com/products/report/docs/tags/tags/pbr.html). You’ll likely have some wasted space on each page, though, and it may take trial and error to get good results.
e
so, basically, paginate yourself, then you’re in control. but cannot do so with straight up macro/header
s
correct, as far as I know, it’s the only way
e
i find it hard to believe nobody has overcome this - if building a catalog of sorts out of Netsuite, you would have likely hit this requirement… without being in total control (it’s too hard to predict the length of the page, unless you overestimate and end up like you said with lots of whitespace)
can you redefine the header macro within the block? for example, I know with each heading i would want to paint a new macro header…
but i see the issue with bfo <> freemarker
s
i have no idea if the macro can be redefined dynamically. But yes, the fact that BFO and Freemarker are two separate and distinct stages of the output make this challenging.
e
😩
s
After Freemarker has processed the template, it is still just a single page HTML document. Remember that they are Advanced PDF/HTML templates, and the output could be either HTML or PDF.
e
💯 just challenging
s
BFO only runs if the output will be PDF, so it is not even guaranteed to happen. But, when it does, all Freemarker variables at that point have been substituted with static values. BFO is only processing a static document, not a template. Therefore, it is just about impossible for Freemarker to signal anything to BFO
And since pages are a PDF only thing (and therefore BFO only) there’s no good option with Freemarker to do it. It can be forced, but will always be clunky
e
yup, understood and thanks. but there’s GOTTA be a way. 🙂
thanks for the help, will report back if i overcome this easily. or hardly.
s
i think the way to do it would be to use a different PDF generation tool/method/service, one that isn’t; trying to support both HTML and PDF at the same time (HTML being non-paged)
BFO is, effectively, arbitrarily breaking that into pages for you. The HTML output wouldn’t have pages. In trying to support both in a single document, some trade-offs have to be made
Another way to think of BFO, is that it is a bit like printing a web page. The printer output would have pages, with breaks, but those pages and breaks would not have appeared within the web page on your browser. They are an artifact of the printer, not the original document. BFO is more like the printer in this scenario.
e
so, basically, the recommended way to approach this is to use
thead
which repeats on pages! this may work for me. thanks
s
interesting, did not not know BFO repeats thead on every page. That’s nice that it does
But can it be changed with every page, or is it static?
e
yaknow i guess it depends how you set it up. the idea is that you set up a table with a thead per title… if you need a certain title to repeat on each page, then update as you go to the next one, if the underlying thead is updated with the new value you will get that repeated on the next page
it’s not exactly the solution i was looking for in describing my problem, i guess, but rethinking it i can probably restructure my data accordingly and get it to print somewhat properly or close to what we need
s
Good to know there is at least some option, and that BFO prints the
thead
on every page (and
tfoot
, too, apparently). Hopefully, with those there is some path towards making this work. Obviously it still doesn’t make it easy, but hopefully not impossible