Thanks, one additional piece of information, the handlebars are being replaced by static text in the header definition only, otherwise the handlebars work as expected. Also, I'm using phantom-pdf.
paul294
@paul294
Posts made by paul294
-
RE: phantom-pdf handlebars in header
-
RE: phantom-pdf handlebars in header
Confuses me also :) . I'll describe this using a different field {{Name}}, corresponding JSON object is { "Name": "Sample Store" }
Step 1) Create a template for the report and add a header that includes {{Name}}.
Step 2) Create the sample JSON object with the required field { "Name": "Sample Store" }
Step 3) Verify the report is correct by clicking the "Run" button. The PDF is rendered correctly with the value of {{Name}} correctly rendered on the PDF.
Step 4) Submit the report from another node application within our system, send in a JSON object with a new JSON object { "Name": "Store ABC" }.
Step 5) The new report is rendered with the sample data "Sample Store".
Step 6) Open the template in jsreports studio to view the header, the {{Name}} element has been replaced with "Sample Store". -
RE: phantom-pdf handlebars in header
Thanks for the fast reply. Yes RunDate is a field in a JSON object, it is included in the sample data that I've used to build the report. It is also in a JSON object that I send in via the API. Both options for running the report have the same issue, after saving the report header with a set of handle bars, it works correctly only for the first run. There is another field in the header {{Pharmacy.Contact.Name}} that also works the same way. The name is correct for the initial run only. I use the Run button within jsreports only to design the report. Our API will then make requests whenever a new report is required via axios.
return axios.post(
requestUrl,
{
template: { shortid: 'rJ89zTUbm' },
data: report
},
{
responseType: 'arraybuffer'
}
);
We recently switched from jsreports 1.8 to 2.0. We did not experience the issue with 1.8. -
phantom-pdf handlebars in header
Hi I am trying to use handlebars in my phantom pdf header, see snipit from header below:
<p style="text-align: right;"><span style="font-family: calibri, sans-serif;">{{RunDate}}</span></p>
This does work as expected the first time I run the report. When running the report a second time, the {{RunDate}} is replace with the static text from the first run, see snipit from modified header below:
<p style="text-align: right;"><span style="font-family: calibri, sans-serif;">2018-07-03</span></p>
All future reports will now have the date of the first report.
We are using jsreports ver 2.0 installed on our own server.
- Is this expected behavior?
- How do I prevent the header from be modified when running a report?
Thanks