Created
January 25, 2018 05:56
-
-
Save satyendra-singh-talentica/f50be5a9840e9a8f18226519b31dcea7 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 htmlPdfChrome = require('html-pdf-chrome'); | |
var options = { | |
port: 9222, | |
printOptions: { | |
printBackground: true, | |
marginTop: 0, | |
marginBottom: 0, | |
marginLeft: 0, | |
marginRight: 0, | |
paperWidth: 14, | |
paperHeight: 8 | |
} | |
}; | |
function generatePDF(html, outputFile) { | |
return htmlPdfChrome.create(html, options) | |
.then(function (pdf) { | |
pdf.toFile(outputFile); | |
return true; | |
}); | |
} | |
module.exports = generatePDF; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment