marcbachmann / node-html-pdf

This repo isn't maintained anymore as phantomjs got dreprecated a long time ago. Please migrate to headless chrome/puppeteer.
MIT License
3.56k stars 542 forks source link

PDF file is not created and command terminal shows no error. #207

Open santhosh12992 opened 7 years ago

santhosh12992 commented 7 years ago

Hi,

I am looking to convert the HTML file created by Jasmine2html reports to PDF format. The Code i have used is pasted below. onPrepare: function() { jasmine.getEnv().addReporter( new Jasmine2HtmlReporter({ savePath: 'target/' }) );

}, onComplete: function() { var fs = require('fs'); var pdf = require('html-pdf'); var html = fs.readFileSync('D:/Protractor/Grunt_Pro/target/htmlReport.html', 'utf8'); var options = { format: 'Letter' }; pdf.create(html, options).toFile('D:/Protractor/Grunt_Pro/target/Success.pdf', function(err, res) { if (err) return console.log(err); console.log(res); // { filename: '/app/businesscard.pdf' } }); }

I have user the pdf code in oncompletion block.

yingliangzhang commented 7 years ago

I'm having the same probably. The html is valid but no PDF generated and no errors. The interesting thing is that seems like it just stops as soon as my template content reached a certain length.

yingliangzhang commented 7 years ago

Hi @santhosh12992 , have you ever figured out this problem?

santhosh12992 commented 7 years ago

@yingliangzhang , No i didn't. I am not using protractor now.