Reports extension save stores pdf before afterRender()
-
I am producing a file that is mostly produced in the afterRender() call. We have recently switched to using the Reports extension using the 'Async' method to save the files to local storage and then monitor the report production status as mentioned here:
https://jsreport.net/learn/reports
{ "template": { "name" : "My template" }, "data" : { ... }, "options": { "reports": { "save": true } } }
From .NET this called as
Reports = new ReportsOptions { Async = true } }
What is happening however is that the locally stored file is only what is produced BEFORE afterRender() runs. The pdf file is not even updated after the afterRender() call completes. Am I missing something or does the storage not handle awaiting the afterRender()?
I am just running the afterRender like so:
async function afterRender(req, res, done) { modify res.content a lot.... done(); }
The PDF runs perfectly when I run it directly in jsreport and immediately view the PDF output. It's only when it is storing that it is storing too early before the process is complete.
-
Thank you for the bug report. I've just fixed it in the master, you can get the particular fix when using jsreport on prem with
npm i jsreport/jsreport-reports#78709e055e0556c10d1021704e5155c197a3eec2
We will include it in the next jsreport full release.
-
Thank you Jan I can confirm that applying that package works perfectly.
-
Just looking at when that 2.11 might come out Jan? I can't see anywhere obvious with your expected release dates but based on last few releases I expect it's pretty close. We can tide over for awhile if it's not too far off.
-
It should come this month.