Convert HTML to pdf report and download in Angular and Fastify
-
Hello,
I am new to jsreport and I'm working on an app based on Angular and Fastify. We are trying to switch from wkhtmltopdf to jsreport and I don't know how to proceed with that. We currently have ejs files for the report. Do I convert the files to handlebars and helper files? I need the report to be generated dynamically and auto-download itself.It would be great if someone could help me out. Thank you in advance.
-
hi! how are you trying to use jsreport in your app? i ask this because, in node.js, jsreport can be integrated in two modes.
1.- you can run jsreport standalone, and this means that it is basically a separate app/server.
2.- you can attach jsreport into an existing express app, and this means that jsreport is just a set of routes specially designed for reporting inside of your app/serverif you are using fastify, i think your best option will be to try option 1.
in both cases, when you need to render something from the front-end, all you need to do is a http request from the browser to the jsreport server/routes, we provide a generic browser client to abstract the http requests, this should work in any browser. however since angular has its own way to do http request, you will need to search a bit and replicate the http request to the jsreport server in the angular way. we don't have experience with angular so that is why there is no example with it, however, this should not be too difficult to achieve. here you can find some details about the http request that you need to do.