How to define variable in template

  • I am generating PDF and I have to add page break in PDF and I am able to do that but at last bank page is coming because i have used page break in the end of for loop

    So, I will add page break option at the start from the second iteration of each loop, in this I will display remove my last black page

    But I am not able to define variable in template so that I can add check :(

    Please help me on that.

    Thanks in advance!

  • administrators


    you can define variables in the helpers section, and the helpers will have access to it, probably you can use that to set the variable with helpers and also do the check with a helper

    // helpers
    var yourCustomVariable
    function helperOne () {
      // you can use your variable here

    if after trying what I'm suggesting you are still having problems try to replicate your problem on the playground and share it here so we can take a look and give you a more specific solution

  • Thanks for quick response, but i asked to define on template not in JS.

    But anyway, I have resolved my page break issue by using Handlebars -> created a new method and called it from HTML :)

    Thanks again for quick response.

Log in to reply

Looks like your connection to jsreport forum was lost, please wait while we try to reconnect.