Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
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;

This comment has been minimized.

Copy link

commented Aug 17, 2018

I am facing issue in pdf generation

Error: connect ECONNREFUSED
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1173:14)
syscall: 'connect',
address: '',
port: 9222 }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.