我已经为Rotativa生成的pdf创建了动态页脚,问题是生成pdf时不显示背景色和文本色。页脚是从视图生成的,当我使用html页脚时,背景和颜色正确显示,但是当我使用视图时,没有颜色和背景显示,只有黑色文本。
这是我的代码:
public ActionResult Footer(int? originalId, string user)
{
TempData["keyEditId"] = originalId;
ViewBag.ind = originalId;
TempData["user"] = user;
return View(db.InvoiceAddlines.ToList());
}
public ActionResult RotativaFooter(int? id, string rt)
{
string header = Server.MapPath("~/UploadedFiles/FooterHeader/PrintHeader.html");//Path of PrintHeader.html File
string customSwitches = //string.Format("" +
string.Format("" +
"--footer-html \"{1}\" " +
"--footer-spacing \"10\" " +
"--footer-font-size \"10\" ", header, Url.Action("Footer", "InvoiceAddlines", new System.Web.Routing.RouteValueDictionary(new { originalId = id, user = rt }), "http"));
return new ActionAsPdf("GemTemp3", new { originalId = id, user = rt })
{
CustomSwitches = customSwitches,
PageMargins = new Margins(10, 10, 36, 10)
};
}
此动态页脚位于我的视图中:
<div style="color:#fff; margin-top:20px; margin-bottom:0px;padding-bottom:20px; background-color:#e1462a " class="row footer">
<div style="padding-top:15px; " class="col-xs-4 ">
<span><i style=" font-size:20px;padding-right:7px; " class="fa fa-map-marker"></i>@AddressLine1 @AddressLine2</span>
</div>
<div style="padding-top:15px; " class="col-xs-4 ">
<span><i style="font-size:20px;padding-right:7px; color:red " class="fa fa-phone"></i> @contact</span>
</div>
<div style="padding-top:15px; " class="col-xs-4 ">
<span><i style=" ; font-size:20px;padding-right:7px" class="fa fa-envelope"></i> @email</span>
</div>
希望有人可以提供帮助。