我使用Rotativa (v1.6.4)将MVC视图转换为PDF。我在视图中使用了jQuery来显示/隐藏某些文本内容。
当我呈现视图时,我看到jQuery正在工作,但是当我呈现viewaspdf时,jquery不工作。
我添加了--debug-javascript --no-stop-slow scripts --javascript-delay 10000,但这看起来不起作用。有人能帮帮我吗?
以下是控制器的详细信息:
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);
}发布于 2019-03-14 23:14:13
我也面临着同样的问题。我通过编辑'App_Browsers‘文件夹中的'qt.browser’解决了这个问题。它是由Rotativa在从NuGet安装软件包期间创建的。我将name="javascriptversion“的功能从1.7改为我的jquery - 3.1.1版本。这解决了我的问题。希望这能帮助到某人
https://stackoverflow.com/questions/47834906
复制相似问题