agmoyano / node-jasper

JasperReports from Node.js
84 stars 52 forks source link

Save Generated PDF #41

Closed rahullad89 closed 5 years ago

rahullad89 commented 5 years ago

once the pdf is generated succussfully , How to Save the generated pdf tried a lot options useing node.writefile etc

agmoyano commented 5 years ago

Have you tried with fs.writeFile?


let pdf = jasper.pdf(data);

fs.writeFile('/path/to/file.pdf', pdf, (error)=>{
  if(error) console.log(error);
})

If pdf variable is not null, your pdf file should be generated.