我有一份报告,它通常在带有 css 的本地主机中工作。但是当我放在服务器上时,不会使用捆绑包加载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;
}
Run Code Online (Sandbox Code Playgroud)
看法 :
@model List<Models.Order>
@{
Layout = null;
}
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>Reports</title> …Run Code Online (Sandbox Code Playgroud)