Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/google-app-engine/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# Rotativa显示HTML页眉和页脚_C#_Asp.net Mvc_Rotativa - Fatal编程技术网

C# Rotativa显示HTML页眉和页脚

C# Rotativa显示HTML页眉和页脚,c#,asp.net-mvc,rotativa,C#,Asp.net Mvc,Rotativa,我最近开始使用Rotativa,工作非常出色!尝试配置PDF文档的页眉和页脚除外 string customSwitches = string.Format("--header-html \"{4}\" --footer-left \"{0} {1} - {2}\" --footer-center \"{3}\" --footer-right \"Page: [page]/[toPage]\" --footer-line --footer-font-size \"9\" --footer-spa

我最近开始使用Rotativa,工作非常出色!尝试配置
PDF
文档的页眉和页脚除外

string customSwitches = string.Format("--header-html \"{4}\" --footer-left \"{0} {1} - {2}\" --footer-center \"{3}\" --footer-right \"Page: [page]/[toPage]\" --footer-line --footer-font-size \"9\" --footer-spacing 6", "Billing Report", FromDate.Value.ToString("yyyy-MM-dd"), ToDate.Value.ToString("yyyy-MM-dd"), customerData.Name, Url.Action("BillingRunHeader", "Report", new { area = "Admin" }, "http"));
var actionResult = new ViewAsPdf("_BillingRunPDF", GetBillingReport(UserFilterReport, ProductFilterReport, ProjectFilterReport, CustomerFilterReport.Where(x => x == customer).ToArray(), TypeFilterReport, ReportType, FromDate, ToDate, Billable, TaskId).ToList())
{
     PageSize = Size.A4,
     PageOrientation = Orientation.Landscape,
     FileName = customerData.Name.Replace(" ","_") + "_Billing_Report_" + DateTime.Now.Date.ToString("yyyy-MM-dd") + ".pdf",
     CustomSwitches = customSwitches
};
上面我创建了一个字符串格式,用数据替换某些占位符。
--header html\“{4}\”
是从存储的
视图
模板中提取出来的,该模板包含一个头部图像,并且显示得非常完美。问题是页脚根本不显示

如果我删除
--header html\“{4}\”
,那么页脚显示得非常好。问题是我需要同时显示页眉和页脚


任何帮助都将不胜感激。

对我来说,只有在用HTML离开页眉和页脚后,它才起作用

return new ViewAsPdf
            {
                ViewName = "RptVistoriador",
                PageSize = Rotativa.Options.Size.A4,
                Model = lstVistoriadorRptViewModel.ToPagedList(1, lstVistoriadorRptViewModel.Count()),                    
                CustomSwitches = $"--footer-html \"{Url.Action("ReportHeader", "Vistoriador", new { area = "" }, "http")}\" --header-html \"{Url.Action("ReportHeader", "Vistoriador", new { area = "" }, "http")}\""
            };

对我来说,它只有在用HTML离开页眉和页脚后才起作用

return new ViewAsPdf
            {
                ViewName = "RptVistoriador",
                PageSize = Rotativa.Options.Size.A4,
                Model = lstVistoriadorRptViewModel.ToPagedList(1, lstVistoriadorRptViewModel.Count()),                    
                CustomSwitches = $"--footer-html \"{Url.Action("ReportHeader", "Vistoriador", new { area = "" }, "http")}\" --header-html \"{Url.Action("ReportHeader", "Vistoriador", new { area = "" }, "http")}\""
            };