How to set the download name of PDF when using renderAsync, and also how to save on server when generated?



  • I have two questions:

    1. I'm using the web client's renderAsync call to run my report. Works great. I'm putting the result into an iframe and it displays just fine. But when I go to download it, the file is named 'download.pdf'. Where can I set the name to something better - like the report name plus parameters?

    2. When I run a PDF report, I'd like to store the result on the server in addition to sending it to the client. How can I do that? Relatedly, where would it be stored so that I can get a listing of stored reports?


  • administrators

    I'm using the web client's renderAsync call to run my report. Works great. I'm putting the result into an iframe and it displays just fine. But when I go to download it, the file is named 'download.pdf'. Where can I set the name to something better - like the report name plus parameters?

    how are you downloading the pdf? are you doing it using the res.download method? or are you using the PDF viewer download button? the res.download should work and give you custom report name. however the other one using the PDF viewer download button is a bit random because we don't control that, it depends on how the pdf was loaded on the iframe, what we recommend is that you always put a custom "download" button that just call res.download for your users.

    When I run a PDF report, I'd like to store the result on the server in addition to sending it to the client. How can I do that? Relatedly, where would it be stored so that I can get a listing of stored reports?

    well, you can send the pdf that you generate to some custom route in your server and save it in any place you want, if you do that you are in control about how to get a listing of the stored reports. the other option is that you use the reports extension, which can store the reports on file system, s3, azure, etc it depends on how you configure the blob storage


Log in to reply
 

Looks like your connection to jsreport forum was lost, please wait while we try to reconnect.