Passing the jsreport template as parameter to api/report
-
We have understood there is an api : http://localhost:5488/api/report to generate a report by where we need to specify template name, data and other optional parameters. Instead of passing the template name as a parameter, is there any api available where we can pass the template itself as parameter.
Please find in the uploaded image, "my-template" is the template name and this has to be replaced with the actual template (uploaded as Template.jpg)
-
Perhaps this documentation answers the question?
https://jsreport.net/learn/api#rendering-without-stored-templates
-
Hello, thanks for the response. Now that we are not using stored templates, how can we apply custom CSS, page numbers and custom font style?
Any article that explains above requirement?
-
In case you don't store entities, you won't be able to use assets, so you will need to send styles inline in HTML.
-
I have used pdf utils for creating paginations for stored templates which creates seperate template, but for dynamic templates how do we add pagination? I have tried couple of links like
- https://stackoverflow.com/questions/31326567/page-number-in-jsreport
- https://jsreport.net/learn/chrome-pdf
but none of them are working in dynamic templates? any sample code or suggestion here?
-
The example for using pdf utils without stored templates can be found here
https://jsreport.net/learn/pdf-utils#api
-
@jan_blaha thanks for the link. But that only shows example of how to send chrom-pdf recipe. I want to send "DOCX" template within request. Can "Content" be a file?
-
There is an example in the docx recipe documentation
https://jsreport.net/learn/docx#api{ "template": { "recipe": "docx", "engine": "handlebars", "docx": { "templateAsset": { "content": "base64 encoded word file", "encoding": "base64" } } }, "data": {} }
-
Thank you so much @admin. One more question: with that (or with stored templates), how can I add custom fonts for use in the template?