我有一份报告,它通常在带有 css 的 localhost 中工作。但是当我放在服务器上时并没有用 bundle 加载 css。
代码 :
public ActionResult ParseSendPDF()
{
var result = Session["Search"] as List<Order>;
ViewAsPdf pdf = new ViewAsPdf("SendPDF", result);
pdf.PageOrientation = Rotativa.Options.Orientation.Landscape;
pdf.PageSize = Rotativa.Options.Size.A4;
pdf.CustomSwitches = "--background";
foreach (var results in result)
{
foreach (var detail in results.OrderDetails)
{
var description = detail.Description;
if (description.Length > 84)
{
SetBreakLine(ref description);
detail.Description = description;
}
}
}
return pdf;
}
看法 :
@model List<Models.Order>
@{
Layout = null;
}
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>Reports</title>
@Styles.Render("~/Content/css")
@Styles.Render("~/Content/trip")
@Styles.Render("~/Content/datetimepicker")
@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/ajax")
@Scripts.Render("~/bundles/modernizr")
@Scripts.Render("~/bundles/datetimepicker")
<style type="text/css">
table { page-break-inside:auto }
tr { page-break-inside:avoid; page-break-after:auto }
thead { display:table-header-group }
tfoot { display:table-footer-group }
</style>
</head>
<body>
<img style="margin-top: -7px;" class="img-responsive" src="~/Content/Images//logo.png" />
<h1 class="text-center">Reports</h1>
@Html.Partial("_Index", Model)
</body>
</html>
在 localhost 工作但在服务器中,我的 css 和徽标不起作用。