Ok! Thank you!
Posts made by Christian Marlon
-
RE: Anonymous template can't find child template also anonymous
Ok... so, I want keep using anonymous template, but I don't see another way in this case...
Actually, my child template is a TOC, and its implementation is like this example: https://playground.jsreport.net/w/admin/akYBA4rS
Is there another way to use TOC without child template?
-
RE: Anonymous template can't find child template also anonymous
Sorry for delay. I set path inside content of main template:
{#child ../path/to/child-template @template.recipe=html}
When I run jsreport.render, I get this message:
Child template "../path/to/child-template" was not found, skipping.
-
Anonymous template can't find child template also anonymous
Hi! I'm using jsreport.render() to rendering two anonymous templates, the main template and a child template for toc (table of contents). However, the main template does not find the child template, and only works when I add the child in jsreport studio. I tried to put the full and relative path on child declaration in main template, without success. How can I make the main template find the child template without having to add it in jsreport studio?
This is an abstract of the code:
jsreport.render({ template: { name: "main-template", content: fs.readFileSync('path/to/main-template').toString('utf-8'), engine: "handlebars", recipe: "chrome-pdf", chrome: { printBackground: true }, pdfOperations: [ { type: "merge", template: { name: "child-template", content: fs.readFileSync('path/to/child-template').toString('utf-8'), recipe: "chrome-pdf", engine: "handlebars", chrome: { printBackground: true }, }, data: { toc }, mergeWholeDocument: true, renderForEveryPage: false } ] }, data: { mainData } }).then((out) => { return out.stream.pipe(res); }).catch((e) => { throw e; });