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 header and footer size options to the config #143

Closed
wants to merge 1 commit into from
Closed

Add header and footer size options to the config #143

wants to merge 1 commit into from

Conversation

elliotblackburn
Copy link
Collaborator

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.

<div id="pageHeader">
  <center>Elliot Blackburn</center>
  <center>My document header</center>
</div>

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?

[html-pdf](https://www.npmjs.com/package/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.

```html
<div id="pageHeader">
  <center>Elliot Blackburn</center>
  <center>My document header</center>
</div>
```

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](https://www.npmjs.com/package/html-pdf#options) 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.
@elliotblackburn
Copy link
Collaborator Author

Chances are, this is nearly redundant now with the right hooks into mdpdf.

@travs
Copy link
Owner

travs commented Aug 20, 2017

Yes I believe you are right. Just opened a new issue about adding those here #163
Will close this one for now

@travs travs closed this Aug 20, 2017
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

Successfully merging this pull request may close these issues.

3 participants