【发布时间】:2014-09-27 01:14:33
【问题描述】:
我们正在使用Rotativa 在网络服务器上保存该页面的永久 PDF 副本。这是构建和保存它的 ASP.NET MVC 4 代码:
var pdfResult = new ActionAsPdf("Index", new { orderId = orderValidated.orderID }) { FileName = filePath };
var binary = pdfResult.BuildPdf(ControllerContext);
// writes only if the file does not exist, we need to keep first authentic print of it.
if (System.IO.File.Exists(filePath) == false)
{
System.IO.File.WriteAllBytes(filePath, binary);
}
我们使用特定的“css”文件在页面<head> 部分进行打印:
<head>
<link media=all href="/Content/invoice.css" type=text/css rel=stylesheet>
<link media=print href="/Content/printInv.css" type=text/css rel=stylesheet>
</head>
“css”打印版本包含:
#logo {background: url(/assets/images/logo-plain.gif) no-repeat; height: 56px}
并且 PDF 文档中缺少 *.gif 图像(屏幕上存在)。
知道它丢失的原因吗?
谢谢。
【问题讨论】:
标签: css asp.net asp.net-mvc pdf pdf-generation