Unable to increase html-to-pdf render timeout in- .Net Core



  • I'm unable to increase the timeout when creating a pretty large PDF. The error I get indicates the default timeout is still being used. Is there another way I should be affecting the timeout?

                var renderRequest = new RenderRequest()
                {
                    Template = new Template
                    {
                        Content = htmlContent,
                        Engine = Engine.None,
                        Recipe = Recipe.ChromePdf,
                        Chrome = new Chrome
                        {
                            MediaType = MediaType.Screen,
                            PrintBackground = true,
                            Landscape = true,
                            WaitForNetworkIddle = false
                        },
    
                    }
                };
                renderRequest.Options.Timeout = 99000; // does not work
    
                //render pdf
                var report = await JsReportMVCService.RenderAsync(renderRequest);
    
    
    "logs":"instance has been daemonized and initialized successfully (pid: 15856)A critical error occurred while trying to execute the render command: Timeout Error: pdf generation not completed after 30000ms (1). caused by error (1) -> meta = {\"remoteStack\":\"Error: Timeout Error: pdf generation not completed after 30000ms\\n    at Timeout.setTimeout (jsreportRuntime.js:151795:19)\\n    at ontimeout (timers.js:482:11)
    


  • jsreport by default doesn't allow altering request timeout through request options.
    You need to opt-in to this in the jsreport configuration.

    Like this

     new LocalReporting()
         .UseBinary(JsReportBinary.GetBinary())
         .Configure(cfg => {
              cfg.EnableRequestReportTimeout  = true;
              return cfg;
          })
         .AsUtility()  
         .Create();
    
    

Log in to reply
 

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