I am using the Rendering plugin for creating PDFs. The plugin is working fine. However, when I click on download as PDF. It redirects me to another page:
It gives me a result in PDF format and then it gives me an option for saving as in this image:
But what I want is when I click on the download as PDF button:
That it will show me a save window directly rather than redirecting me to another page.
My code:
def renderFormPDF(Long id){
def empinstance= emp.get(id)
renderPdf(template:"view", model:[empinstance:empinstance, pdfRendering:true])
}
Try this
def renderFormPDF(Long id){
def empinstance= emp.get(id)
response.setContentType("application/pdf")
response.setHeader("Content-Disposition", "attachment; filename=fileName.pdf")
renderPdf(template:"view", model:[empinstance:empinstance, pdfRendering:true])
}