Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add viewhelper for header / footer elements #31

Closed
macjohnny opened this issue Nov 13, 2017 · 8 comments
Closed

Add viewhelper for header / footer elements #31

macjohnny opened this issue Nov 13, 2017 · 8 comments

Comments

@macjohnny
Copy link
Member

No description provided.

@macjohnny
Copy link
Member Author

Currently, it is necessary to extend the class defined in plugin.tx_pdfviewhelpers.settings.config.class, overwrite the Header() or Footer() method or both and set the custom class in plugin.tx_pdfviewhelpers.settings.config.class

The Header() and Footer() methods are called for every new page added.

@macjohnny
Copy link
Member Author

@PeterSchuhmann
Copy link

I think this solution only works if you have a static header and footer. but what if you want to add dynamic data like data from your model?

@maechler
Copy link
Member

I think @macjohnny is proposing a feature similar to this:

<pdf:document>
   <pdf:header>
       <pdf:text>Some headline text: {yourVariable}</pdf:text>
   </pdf:header>
   <pdf:footer>
       <pdf:text>Footer, we are on page {currentPage}</pdf:text>
   </pdf:footer>
   <pdf:page>
       <pdf:header>Maybe we can overwrite header and footer on pages?</pdf:header>
   </pdf:page>
</pdf:document>

It should be possible to define header and footer on document level. Probably there should also be the possibility to overwrite header and footer on page level and variables like {currentPage} should be provided. In this scenario you could use dynamic data from your model.
I am not sure however how this feature could be implemented. Maybe it is possible to store a reference to e.g. HeaderViewHelper and then render its children on each page with a new set of variables like {currentPage}.

@Gernott
Copy link
Contributor

Gernott commented Mar 19, 2018

That would be great! I would sponsor €100 for something like this.

@maechler
Copy link
Member

maechler commented Sep 1, 2018

I started progress on this one and created a working example: bb942c3
https://github.com/bithost-gmbh/pdfviewhelpers/tree/feature/headerFooterSupport

It seems to be easier than expected, although it still needs some effort until it is ready to be used.

@maechler
Copy link
Member

maechler commented Sep 6, 2018

This is implemented and tested in the current develop branch and will be released as part of pdfviewhelpers v2.

@maechler maechler closed this as completed Sep 6, 2018
@maechler
Copy link
Member

maechler commented Oct 4, 2018

@Gernott I just released pdfviewhelpers v2, it contains header and footer ViewHelpers and lots of other features. If you still feel like sponsoring, a contribution would be very welcome!
See https://github.com/bithost-gmbh/pdfviewhelpers#support-development

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants