node-html-pdf
node-html-pdf copied to clipboard
get the filepath outside the .toFile()
I have this code
var pdfPath = '';
pdf.create(pdfTemplate('some name goes here'), {})
.toFile(`./test/${req.body.propertyType}.pdf`, function(err, res) {
if (err) {
return console.log(err)
} else {
// console.log(res.filename) //works returns res.filename
pdfPath = res.filename
}
})
console.log(pdfPath) //not working not returning res.filname
How can I get the res.filename to use it somewhere else?
Thanks!
Same problem! :(