Rotativa ViewAsPdf not executing jquery

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-10 18:19:13

问题


I'm using Rotativa (v1.6.4) for converting an MVC view into a PDF. I have used jQuery in the View to show/hide certain text content.

When I render the View, I see that jQuery is working, but when I render viewaspdf, the jquery is not working.

I have added --debug-javascript --no-stop-slow-scripts --javascript-delay 10000 but this looks to be not working. Can someone help me here?

Here is Controller detail:

    public ActionResult PrintBenificiaryForm()
    {
        PrintBenificiary p = new PrintBenificiary();
        p.TeamMemberInfo = GetSessionValues();
        p.IndividualBenefitPlans = GetBenefitPlansandIndividuals();

        string customSwitches = string.Format("--debug-javascript --no-stop-slow-scripts --javascript-delay 10000 --footer-left \"[page] of [toPage]\" --footer-spacing -10 --footer-font-size \"10\"  --header-html  \"{0}\" ", Url.Action("PrintHeader", "Home", null, this.Request.Url.Scheme));
        return new ViewAsPdf("PrintBenificiaryForm", p)// { FileName = p.TeamMemberInfo.FirstName + " " + p.TeamMemberInfo.LastName + ".pdf" };
        {
            CustomSwitches = customSwitches
        };
        //return View(p);
    }

回答1:


I faced the same issue. I resolved this by editing 'qt.browser' in the 'App_Browsers' folder. It was created by Rotativa during the installing package from NuGet. I changed capability with name="javascriptversion" from 1.7 to my version of jquery - 3.1.1. And this resolved my issue. Hope this help someone



来源:https://stackoverflow.com/questions/47834906/rotativa-viewaspdf-not-executing-jquery

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!