From 024a62525e6e45a70396e4255734aa2c7afdbc29 Mon Sep 17 00:00:00 2001 From: Elliot Blackburn Date: Fri, 13 Jan 2017 14:04:12 +0000 Subject: [PATCH] Add header and footer size options to the config [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 ``` 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. --- lib/markdown-pdf.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/lib/markdown-pdf.js b/lib/markdown-pdf.js index e9d2ef9..1740104 100644 --- a/lib/markdown-pdf.js +++ b/lib/markdown-pdf.js @@ -45,6 +45,28 @@ module.exports = { "minimum": 1, "maximum": 100, "default": 100 + }, + "header": { + "title": "Header Settings", + "type": "object", + "properties": { + "height": { + "title": "Height (mm) of the header", + "type": "string", + "default": "0mm" + } + } + }, + "footer": { + "title": "Footer Settings", + "type": "object", + "properties": { + "height": { + "title": "Height (mm) of the footer", + "type": "string", + "default": "0mm" + } + } } },