address data print new line



  • My address data return on the pdf report like below.

    No 99, street1\r\nstreet 2.

    i would like to print to new line. i tried write a function to replace the \r\n to <br />.

    function replace(value){
    var result = value.replace(/\r\n/, "<br />");
    return result;
    }

    but it return No 99, street1<br />street 2 instead print new line.

    anyone can help? I want the address to show like below

    No 99, street1
    street2

    Thanks in advance



  • The replace function seems good solution. You perhaps just need to use triple brackets to avoid handlebars html escaping

    {{{foo}}}
    


  • Hi,

    Thanks for the reply and your solution working perfectly!!!! thank you and appreciate that



  • And how would you do this using chrome-pdf engine?


  • administrators

    hi @silverWeaver, for chrome it should be the same, you need a helper function that handles the conversion from new line character (\r\n) to html line break <br />.

    if you need more help, replicate your template and data on the playground and share it back in this topic


Log in to reply
 

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