diff --git a/README.md b/README.md index 9421b66..deed5c0 100644 --- a/README.md +++ b/README.md @@ -93,9 +93,9 @@ config = { "orientation": "portrait", // portrait or landscape // Page options - "border": "0", // default is 0, units: mm, cm, in, px + "margin": "0", // default is 0, units: mm, cm, in, px - or - - "border": { + "margin": { "top": "2in", // default is 0, units: mm, cm, in, px "right": "1in", "bottom": "2in", diff --git a/lib/pdf.js b/lib/pdf.js index 4ca1afd..102447b 100644 --- a/lib/pdf.js +++ b/lib/pdf.js @@ -32,6 +32,8 @@ function PDF (html, options) { this.script = path.join(__dirname, 'scripts', 'pdf_a4_portrait.js') } + if (this.options.border && !this.options.margin) this.options.margin = this.options.border + if (this.options.filename) this.options.filename = path.resolve(this.options.filename) if (!this.options.phantomPath) this.options.phantomPath = phantomjs && phantomjs.path this.options.phantomArgs = this.options.phantomArgs || [] diff --git a/lib/scripts/pdf_a4_portrait.js b/lib/scripts/pdf_a4_portrait.js index 3542baa..d757a21 100755 --- a/lib/scripts/pdf_a4_portrait.js +++ b/lib/scripts/pdf_a4_portrait.js @@ -192,7 +192,7 @@ function createSection (section, content, options) { // Creates paper with specified options // ------------------------------------ function definePaperOrientation (options) { - var paper = {border: options.border || '0'} + var paper = {margin: options.margin || '0'} if (options.height && options.width) { paper.width = options.width