Created
January 25, 2018 05:54
-
-
Save satyendra-singh-talentica/80ac91561d9fe932e1ebb7d0b952896d 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 dataGathererService = require('./dataGathererModule/dataGathererService'); | |
var htmlGenerator = require('./pdfTemplate/htmlGenerator'); | |
var generatePDF = require('./pdfGenerator/pdfGenerator'); | |
var constants = require('./constants'); | |
function pdfGeneratorService() { | |
var templateFile = './pdfGenerationModule/pdfTemplate/template.ejs'; | |
var outputFile = constants.PDF_OUTPUT_DIR + 'pdf-' + new Date().getTime() + '.pdf'; | |
return dataGathererService() // Gets Data | |
.then(function (data) { | |
return htmlGenerator(templateFile, data); // Builds HTML | |
}) | |
.then(function (html) { | |
return generatePDF(html, outputFile); // Builds PDF | |
}) | |
.then(function (success) { | |
console.log('PDF generation successful at ' + outputFile); | |
return success; | |
}) | |
.catch(function (err) { | |
console.log('ERROR in PDF generation : ' + err); | |
return false; | |
}); | |
} | |
module.exports = pdfGeneratorService; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I am facing issue in pdf generation
Error: connect ECONNREFUSED 127.0.0.1:9222
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1173:14)
errno: 'ECONNREFUSED',
code: 'ECONNREFUSED',
syscall: 'connect',
address: '127.0.0.1',
port: 9222 }