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

custom css for header/footer #45

Closed
mvaDevelop opened this issue Oct 20, 2022 · 1 comment
Closed

custom css for header/footer #45

mvaDevelop opened this issue Oct 20, 2022 · 1 comment

Comments

@mvaDevelop
Copy link

I'm trying to add a header to a pdf with margins. These margins are calculated specifically for the content loaded in the pdf and should not be exceeded, as this cuts off part of the pdf content. However, to show the header inside the pdf, i followed the instructions on #9 which stated that the margins should be big enough to show the header content.

Is there a way to add header/footer to pdf without it using the margins set in the options? Or maybe overwriting the margins for the header?

afbeelding
afbeelding

  • additional issue/question: is it possible to add numbering to specific pages of the pdf, and resetting this to 1 on page x? The content loaded on my pdf are x amount of lists, so if possible, I would like to add numbering like this: list 1 has 10 pages and should show in header 'page 1 out of 10', then a new list begins on page 11, so list 2 should show 'page 1 out of 10' again
@spiritix
Copy link
Owner

You can try to set inline paddings or margins inside the header and/or body HTML instead of using the margins option. Regarding the page numbers - they get injected automatically in the footer or header if you use certain HTML classes. You can find them here: https://pptr.dev/api/puppeteer.pdfoptions.headertemplate
I don't think you'll be able to reset them.

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

No branches or pull requests

2 participants