Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 2 additions & 0 deletions lib/pdf.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 || []
Expand Down
2 changes: 1 addition & 1 deletion lib/scripts/pdf_a4_portrait.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down