-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
different headers/footers for different sections? #283
Comments
Hi, this is definitely an interesting feature - so if you have a working solution, I would like to have a look into it. |
Okay, I had a go at adding the feature here: surgeforward@382586f I tried to make a test for it, but haven't been able to quite wrap my mind around the testing suite yet. FWIW, here is a document that will use the feature:
|
I would prefer to pass the nodes of this page (similar to the |
Great idea! (There's no reason that should have the same performance hit as |
It's highly possible that there will be the same performance issue with that. |
Ouch! |
+1 for this but please also add it for the header section. |
Is there a plan on merging @hujhax PR? It is a 3 years old PR , but for a very good feature... |
I created a custom footer that resets page numbering each time I start a new section (which is always on a new page). I was able to achieve that using the current prod release (no fork). In naxmefy 's answer to #1441 I observed that,
With the above I was able to find the last section that landed on a page no higher than the current page number. Then I just deduct that page number from my current page number to get the section's page number. A bit too complicated/specific (mixed in with Angular) for me to pull together a sample, but hopefully this helps. |
what is the state of this feature? Any chance to help? |
Any plans to get this in? |
If anyone is interested, some of the functionality discussed in this thread can be achieved using this solution: Obviously it would be ideal if it's officially supported, but the above link is a pretty good way to get dynamic footers/headers in. |
I stumbled into something that might be a useful feature to add.
For this project I'm working on, different sections of the pdf document need to have different footers. Unfortunately, I have no way of knowing which section starts on which page, so the page-number parameter given to the footer method is no help to me. :(
I ended up adding a property called "
footerMode
" to certain nodes, as a way of letting pdfMake know which section I was in. Then, inprocessNode
, I kept track of the "currentfooterMode
", re-setting it whenever I hit a node withfooterMode
set. Meanwhile, I added afooterMode
property to the pages, and I kept setting the current page'sfooterMode
to that "currentfooterMode
" value. Finally, inaddDynamicRepeatable
, I passed the current page'sfooterMode
down fromaddDynamicRepeatable
intonodeGetter
as a third parameter, thus giving the footer method access to it.There are still some flaws to this approach -- I suspect it's not the cleanest code, it adds yet another property onto the
pages
array-items, and it doesn't account for multiple overlapping sections. But maybe this could be the basis of a more general "section" property? Or have I already overlooked a feature like this that's already there?Let me know if it would be worth it to set up a pull request for this.
The text was updated successfully, but these errors were encountered: