diff options
-rw-r--r-- | README.md | 10 | ||||
-rw-r--r-- | lib/generate/ebook/index.js | 8 |
2 files changed, 16 insertions, 2 deletions
@@ -98,6 +98,16 @@ Here are the options that can be stored in this file: "facebook": null, "twitter": null } + }, + + + // Options for PDF generation + "pdf": { + // Add toc at the end of the file + "toc": true, + + // Font size for the fiel content + "fontSize": 12 } } ``` diff --git a/lib/generate/ebook/index.js b/lib/generate/ebook/index.js index 0c5a664..0cde1a9 100644 --- a/lib/generate/ebook/index.js +++ b/lib/generate/ebook/index.js @@ -30,6 +30,10 @@ Generator.prototype.finish = function() { .then(function() { var d = Q.defer(); var format = that.options.extension || path.extname(that.options.output); + var pdfOptions = _.defaults(that.options.pdf || {}, { + "fontSize": 12, + "toc": true + }); if (!that.options.cover && fs.existsSync(path.join(that.options.output, "cover.jpg"))) { that.options.cover = path.join(that.options.output, "cover.jpg"); @@ -51,8 +55,8 @@ Generator.prototype.finish = function() { "--margin-right": "62", "--margin-top": "36", "--margin-bottom": "36", - "--pdf-add-toc": true, - "--pdf-default-font-size": "12", + "--pdf-add-toc": Boolean(pdfOptions.toc), + "--pdf-default-font-size": String(pdfOptions.fontSize), "--paper-size": "a4", }); } |