Skip to content

Instantly share code, notes, and snippets.

@satyendra-singh-talentica
Created January 25, 2018 05:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save satyendra-singh-talentica/f50be5a9840e9a8f18226519b31dcea7 to your computer and use it in GitHub Desktop.
Save satyendra-singh-talentica/f50be5a9840e9a8f18226519b31dcea7 to your computer and use it in GitHub Desktop.
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