From a56b559d43ddb1f0271f211dbc72eb86bfa164b3 Mon Sep 17 00:00:00 2001 From: Alexandre Aquiles Date: Mon, 6 Oct 2014 13:17:34 -0300 Subject: [PATCH] Adding options to set header and footer in PDF generation --- README.md | 8 +++++++- lib/generate/config.js | 8 +++++++- lib/generate/ebook/index.js | 4 +++- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index f422aaf2e..47146e06b 100644 --- a/README.md +++ b/README.md @@ -118,7 +118,13 @@ Here are the options that can be stored in this file: "left": 62, "top": 36, "bottom": 36 - } + }, + + //Header HTML template. Available variables: _PAGENUM_, _TITLE_, _AUTHOR_ and _SECTION_. + "headerTemplate": null, + + //Footer HTML template. Available variables: _PAGENUM_, _TITLE_, _AUTHOR_ and _SECTION_. + "footerTemplate": null } } ``` diff --git a/lib/generate/config.js b/lib/generate/config.js index 0b270a314..76b0d79c6 100644 --- a/lib/generate/config.js +++ b/lib/generate/config.js @@ -83,7 +83,13 @@ var CONFIG = { "left": 62, "top": 36, "bottom": 36 - } + }, + + //Header HTML template. Available variables: _PAGENUM_, _TITLE_, _AUTHOR_ and _SECTION_. + "headerTemplate": null, + + //Footer HTML template. Available variables: _PAGENUM_, _TITLE_, _AUTHOR_ and _SECTION_. + "footerTemplate": null } }; diff --git a/lib/generate/ebook/index.js b/lib/generate/ebook/index.js index 0e1cd4e9b..eb85b3005 100644 --- a/lib/generate/ebook/index.js +++ b/lib/generate/ebook/index.js @@ -55,7 +55,9 @@ Generator.prototype.finish = function() { "--pdf-default-font-size": String(pdfOptions.fontSize), "--pdf-mono-font-size": String(pdfOptions.fontSize), "--paper-size": String(pdfOptions.paperSize), - "--pdf-page-numbers": Boolean(pdfOptions.pageNumbers) + "--pdf-page-numbers": Boolean(pdfOptions.pageNumbers), + "--pdf-header-template": pdfOptions.headerTemplate, + "--pdf-footer-template": pdfOptions.footerTemplate }); }