【发布时间】:2016-02-15 03:05:11
【问题描述】:
我们在 .Net MVC 5 项目中使用 Rotativa。它在本地像魅力一样工作,并且在部署到服务器时同样失败(生成空白 PDF)。但是,如果我登录到服务器并以 localhost 身份访问该网站,它会生成 PDF 就好了。
因此,它看起来像是运行应用程序池的权限问题。因此,出于测试目的,我更改为运行应用程序池以在“本地系统”上运行。还是同样的问题。
我们也试过:
- “查看PDF”
- 应用设置如下:
<add key="WkhtmltopdfPath" value="<path to the folder>"/>
下面是代码:
return new ActionAsPdf("ActionMethod",new { id = id, partSelected = part, selectedTab = selectedTab, isDownload = true })
{
FileName = fileName,
PageMargins = { Left = 0, Right = 0 },
CustomSwitches = "--disable-external-links --disable-internal-links --disable-smart-shrinking --viewport-size 1600x900 --load-error-handling ignore",
PageOrientation = Rotativa.Options.Orientation.Portrait,
PageSize = Rotativa.Options.Size.A4,
PageWidth = 210,
PageHeight = 297
};
【问题讨论】:
-
服务器有错误提示吗?
标签: asp.net-mvc pdf rotativa