Rotativa ActionAsPdf() Very Slow

后端 未结 2 1233
粉色の甜心
粉色の甜心 2021-01-13 21:42

Using Rotativa 1.6.4 from NuGet and have noticed the following issue using the code below.

ActionAsPdf hangs randomly for indeterminate amount of time.

Cod

相关标签:
2条回答
  • 2021-01-13 22:21

    In my case, I had to do few more tweaks along with using UrlAsPdf(). I have narrowed down the issue to the cookie collection that I was adding. So I tried just adding the cookie that I needed, and the issue was resolved. Following is the sample code that I have used.

            var report = new UrlAsPdf(url);
    
            Dictionary<string, string> cookieCollection = new Dictionary<string, string>();
            foreach (var key in Request.Cookies.AllKeys)
            {
               if (Crypto.Hash("_user").Equals(key))
               {
                  cookieCollection.Add(key, Request.Cookies.Get(key).Value);
                  break;
               }
            }
            report.Cookies = cookieCollection;
            report.FormsAuthenticationCookieName = FormsAuthentication.FormsCookieName;
    
    0 讨论(0)
  • 2021-01-13 22:22

    I ended up using UrlAsPdf() instead of ActionAsPdf() and it works. Seems there may be some issues with the ActionAsPdf() and I have filed a bug with Rotative project on GitHub. The ActionAsPdf() is still marked as beta, so hopefully it get's fixed in future versions or by the community.

    0 讨论(0)
提交回复
热议问题