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 543 forks source link

Can't create a pdf without an html string #557

Closed keerthidl closed 4 years ago

keerthidl commented 4 years ago

hi, i was trying generate a pdf from html file, here basically i have two html files in one folder, both these html files should be converted to pdf, one pdf file is getting generated, but the other one not, same logic used and i have used html-pdf node package html string

`router.get('/template/:ptId',(req, res) =>{ Invoice.find({ptId:req.params.ptId}, function(err, alldetails){ if (err){ res.status(400).json(err) }else { res.status(200).render('template', {alldetails:alldetails}, function(err, html){ pdf.create(html, options).toFile('../public/pdf/invoice.pdf',function(err, res){ if(err){ console.log(err); }else { console.log(res) } }) res.send(html) }) } });

`})``