Add header and footer size options to the config #143
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
html-pdf package allows the use of headers and footers which are placed automatically at the top and bottom of each page, a code sample is below.
The html-pdf default height for a header is 40mm which is a quite big, but the html-pdf package allows configuration of this value in the options object.
As the the html-pdf options are currently read in directly from this packages configuration, I've added two new options with defaults for the user to modify.
This solution isn't perfect though, using a default of 0mm means when the user adds a header or footer for the first time without modifying these values, the header or footer won't display. This could be confusing for new years trying to make use of the feature.
I'm open to suggestions of how to make this better but this time around I wanted to reduce the code added. Perhaps we add a function which checks for a header / footer in the HTML and then uses a default of value such as 20mm, otherwise it defaults to 0mm?