node-html-pdf icon indicating copy to clipboard operation
node-html-pdf copied to clipboard

get the filepath outside the .toFile()

Open kemoboy opened this issue 2 years ago • 1 comments

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!

kemoboy avatar Sep 13 '21 16:09 kemoboy

Same problem! :(

oscarcornejo avatar Oct 20 '21 13:10 oscarcornejo