pdfCreatePagesGroup and pdfAddPageItem using jsrenderengine
-
Hi,
Can you please provide the jsrender syntax for the following example https://playground.jsreport.net/w/admin/ihh7laK2
Cheers!
-
https://playground.jsreport.net/w/anon/4G8~kOyz
It is just a helper call. So the syntax in jsrender is
{{:~pdfAddPageItem(1)}}
-
That's great, thank you, How about the calling syntax I'm struggling to get that working now?
{{#with (lookup $pdf.pages $pdf.pageIndex)}}
This page is in the group with value {{{group}}}
{{/with}}
-
@bjrmatos Please rewrite this whole demo to the jsrender and link it here and also in the pdf utils docs. Thank you.
-
@ThePolymorph I'll chime in with my jsrender experience, if you don't mind.
I started out all-in with jsrender, becuase I thought it was much better than handlebars. But reality caught up and I have now migrated all of my reports to Handlebars. Because:
- Lack of examples in jsreport (seems to be somewhat mitigated now)
- Lack of examples in the public. Handlebars is soo much bigger. it's really easy to get help on Stack Overflow or elsewhere
- I don't know how it is in JSR 2.6, but in 2.5 an older version of jsrender was implemented, some features where not included (for example loop filters)
- I found that helpers could be as powerful in Handlebars as in jsrender.
- I'm now using the helper package handlebars-helpers, both for it's features and as inspiration for my own helpers
-
I don't know how it is in JSR 2.6, but in 2.5 an older version of jsrender was implemented, some features where not included (for example loop filters)
jsreport 2.6.0 has now the latest jsrender FYI https://github.com/jsreport/jsreport/releases/tag/2.6.0
-
@jan_blaha thanks for looking in to this. I'm looking forward to seeing the complete example. @msageryd yeah I switched from handlebars to jsrender a while ago and also have gone "all in", from memory I couldn't get "if" statements working in handlebars and made the switch purely on that, if they are now supported then I don't think switching back would be out of reach. My other big concern is perfomance so I'm not sure if there are any benefits either way. I won't deviate this post from the original request but it does make an interesting discussion, thanks.
-
the example with jsrender is ready and it is available here https://playground.jsreport.net/w/admin/zjSOfVWn
i've also updated the pdf-utils docs with link to it but it will be online when we push a new release of the docs.
-
@bjrmatos awesome, thank you very much!!
-
@bjrmatos for pdfutils I'm not sure if you've updated the examples on the actual page to jsrender too, there's one that explains how to pass an object like this {{{pdfCreatePagesGroup name="Jan" age=33}}}, I tried {{:~pdfCreatePagesGroup(name="jan",age=33)}} but no joy, am I missing something obvious?
-
for jsrender the syntax to pass such object will be like this
{{pdfAddPageItem name="Jan" age=33 /}}