Thanks a lot for the reply.
I got it to work with the following option:
<script type="text/javascript">
{#asset jsLibrary.min.js}
</script>
Thanks a lot for the reply.
I got it to work with the following option:
<script type="text/javascript">
{#asset jsLibrary.min.js}
</script>
I want to try using a javascript library in jsReport.
When I add the library to the <head> section of report and the library is an external library, it works fine:
<script src="https://website.com/libraries/jsLibrary.min.js"></script>
But if I have the source of the library that I want to include directly in report, that is not working. I have tried adding javascript library inside the report folder and accessing it the following way but it does not work:
<script type="text/javascript" src="/jsLibrary.min.js"></script>
I have also tried adding the javascript file as an asset of the report and then using following code and it does not work:
<script type="text/javascript" src=" {#asset jsLibrary.min.js}"></script>
Any help will be appreciated.
Thanks.
Hello, I created a CSV jsReport but having difficulties loading the report in the screen or downloading it.
My PDF Reports work great, and I was trying to use same approach as the PDF, but changing the Content Disposition, so basically, it is something like this:
const reportResponse = await this.client.render({
template: {
name: report.templateName,
},
data
});
const buffer = await reportResponse.body();
response.set({
'Content-Type': 'text/csv',
'Content-Disposition': 'attachment; filename=example.csv',
'Content-Length': buffer.length
});
response.end(generatedReport.buffer);
So as I mentioned before this code is working to render PDF, but it does not work for CSV. When I look into the Console errors, I'm getting error "Unexpected token R in JSON at position 0", where R is the first character of the first header column of the CSV file. I can see in the Network Response tab in chrome that I get a Response back with all the content of the file, but it seems that it's trying to parse the text of the csv file as a JSON object.
Second attempt was trying to install jsReport browser-client (npm i @jsreport/browser-client), add "import jsreport from '@jsreport/browser-client', and use:
const report = await jsreport.render({
template: {
name: reportName
},
data: reportData
})
report.download('covid19.csv')'''
But this approach is given error: SyntaxError: Unexpected token 'export' at ....api\webpack:\external "@jsreport\browser-client":
Is there a CSV example jsReport Client implementation I could use?
I will appreciate any help I can get on this topic. Thanks
Thanks a lot for your help. You point me in the right direction and I was able to advance in my project.
Hello,
I am trying to configure jsreport-client in an angular application.
I followed typescript example on https://github.com/jsreport/jsreport-typescript-example
I created a service file to render reports using code on jsreport-typescript-example/src/client.ts file of the example.
I install jsreport, jsreport-client, @types/jsreport, and @types/jsreport-client.
But when I try to run my application I am getting different errors:
ERROR in ./node_modules/jsreport-client/lib/client.js
Module not found: Error: Can't resolve 'https' in 'C:\Users\Carlos\Source\Repos\AngularSamples\reports\node_modules\jsreport-client\lib'
ERROR in ./node_modules/jsreport-client/lib/client.js
Module not found: Error: Can't resolve 'stream' in 'C:\Users\Carlos\Source\Repos\AngularSamples\reports\node_modules\jsreport-client\lib'
Any idea why this could be or how to resolve issue?
Thanks for any help.