Access to Rendering Request time taken in afterRender function

  • Hi

    I hope you are well.

    Is it possible to have access to how long a template took to render in the after render function?
    The reason I need this is because I would like to only send the rendered report via Email using the node mailer module if the report has taken longer than 2minutes to render.

  • administrators


    I think you can do this to get how much time it took for the current render to get to the afterRender step

    function afterRender (req, res) {
        const executionTimeMs = new Date().getTime() - req.context.startTimestamp

    just have in mind that the req.context.startTimestamp represents the start time of the current template, so if somehow the script is attached to a child template it will only give you how much time it tooks that specific child render, as long as you attach this script to your main template you will be able to get the time you expect.

Log in to reply

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