Last active
August 29, 2015 13:57
-
-
Save TJkrusinski/9529620 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var NodePDF = require('nodepdf'); | |
// last argument is optional, sets the width and height for the viewport to render the pdf from. (see additional options) | |
var pdf = new NodePDF('http://www.yahoo.com', 'yahoo.pdf', { | |
'viewportSize': { | |
'width': 1440, | |
'height': 900 | |
}, | |
'args': '--debug=true' | |
}); | |
pdf.on('error', function(msg){ | |
console.log(msg); | |
}); | |
pdf.on('done', function(pathToFile){ | |
console.log(pathToFile); | |
}); | |
// listen for stdout from phantomjs | |
pdf.on('stdout', function(stdout){ | |
// handle | |
}); | |
// listen for stderr from phantomjs | |
pdf.on('stderr', function(stderr){ | |
// handle | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment