To extend time out during report generation.



  • I have a rather complicated html code in the view and the report needs a longer time than the default 30 seconds to generate the structure. I'm using JSReport version 2.7.1. Initially, I tried modifying the jsreport.config.json file from "chrome": { "timeout": 180000 } to a very big number but that did not work.

    And so ,I have been trying to extend jsreport timeout and here is where I am at.

     HttpContext.JsReportFeature()
                .Recipe(Recipe.ChromePdf)
                .Configure((r) => r.Template.Chrome = new Chrome
                {
                    Landscape = true,
                    Format = "Legal",
                    HeaderTemplate = header,
                    FooterTemplate = footer,
                    DisplayHeaderFooter = true,
                    MarginTop = "95px",
                    MarginLeft = "20px",
                    MarginRight = "20px",
                    MarginBottom = "40px"
                }
                )
                .Configure((r) => r.Options = new jsreport.Types.RenderOptions
                 {
                     Timeout = 600000
                 });
    

    In the above case the styling works but the timeout is not implemented. However if i reverse the order of the configure and put the timeout first and the styling next, the timeout works but not the styling.

    I have also tried the below method and even here it's either a case of report loading without the style or timing out with the error "JsReportBinaryException: Error rendering report: starting rendering process..rendering has finished with errors:A critical error occurred while trying to execute the render command (2). Timeout Error: pdf generation not completed after 30000ms (1). caused by error (2):-> stackError: at onCriticalError (D:\snapshot\jsreport\node_modules\jsreport-cli\lib\commands\render.js:302:19) at D:\snapshot\jsreport\node_modules\jsreport-cli\lib\commands\render.js:298:12caused by error (1):-> meta = {"workerTimeout":true,"logged":true}-> stackError: at Timeout.<anonymous> (D:\snapshot\jsreport\node_modules\jsreport-chrome-pdf\lib\conversion.js:293:19) at listOnTimeout (internal/timers.js:549:17) at processTimers (internal/timers.js:492:7)"

     HttpContext.JsReportFeature()
     .Recipe(Recipe.ChromePdf)
     .Configure(cfg =>
     {
         cfg.Options = new RenderOptions
         {
             Timeout = 600000
          };
          cfg.Template.Chrome = new Chrome
          {
                         Landscape = true,
                         Format = "Legal",
                         HeaderTemplate = header,
                         FooterTemplate = footer,
                         DisplayHeaderFooter = true,
                         MarginTop = "95px",
                         MarginLeft = "20px",
                         MarginRight = "20px",
                         MarginBottom = "40px",
                         PrintBackground = true
          };                     
          })
    

    Is there a way I can combine both and have both working?




Log in to reply
 

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