Problem with downloading the file.
-
Hi the report is generating correctly but the file doesn't want to download it :(
what is the problem ?<button type="button" onclick="downloadPDF()">Pobierz</button> <script src="https://unpkg.com/@jsreport/browser-client/dist/jsreport.umd.js"></script> jsreport.serverUrl = 'http://localhost:5488/' function downloadPDF() { jsreport.render({ 'template': { 'shortid': 'Ngmy7zdGi', 'recipe': 'chrome-pdf' }, "options": { "reports": { "async": true } } }); jsreport.download({ 'shortid': 'Ngmy7zdGi'}); }
-
Please check the api and example here
https://jsreport.net/learn/browser-clientjsreport.serverUrl = 'http://myjsreport.com' const report = await jsreport.render({ template: { name: 'myTemplate' }, data: { someData: 'hello' } }) // download the output to the file report.download('myreport.pdf')
-
Now I see you use the async report rendering (
options.reports.async == true
). Is this intentional?The code from the docs doesn't work for the async reports. You would need to remove the
options.reports.async
.In case you still want to use the async report from the js client, you need to implement the polling as described here on your own.