Save file opened with navigateToURL

108 Views Asked by At

I'm using navigateToURL to open a PDF file generated by Jasper and it's working well. Now I was asked to send an email with the PDF file as an attachment. We are using Velocity to send emails in our application but, to send attachments, we have to have the file saved somewhere and have the info of the path and filename. Is it possible to save to file opened by navigateToURL?

I'm using Flex SDK 4.9.1.

Thank you.

1

There are 1 best solutions below

1
Yasuyuki  Uno On

Are you using JasperExportManager.exportReportToPdfStream() method to show the PDF?

If so, try to use JasperExportManager.exportReportToPdfFile().
Then you can save the PDF at server.

JasperPrint jasperprint = JasperFillManager.fillReport(jasper, paramMap, con);
// Streaming pdf now?
response.setContentType("application/pdf");
JasperExportManager.exportReportToPdfStream(jasperprint, response.getOutputStream());

// Save the PDF somewhere.
JasperExportManager.exportReportToPdfFile(jasperprint, path);