我尝试在ASP.NET核心中使用Rotativa,这是我的代码。
public IActionResult Index(int artID)
{
var art = articleService.GetArticleForPrint(artID);
return View(art);
}
public IActionResult PrintSpecifcArticle(int id)
{
var report = new ActionAsPdf("Index", new { artID = id })
{
FileName = "Invoice.pdf"
};
return report;
}我安装了这个软件包:Rotativa.NetCore 1.0.4
但它给了我一个错误:
System.ComponentModel.Win32Exception: The system cannot find the file
specified
at System.Diagnostics.Process.StartCore(ProcessStartInfo startInfo)
at System.Diagnostics.Process.Start()
at Rotativa.NetCore.WkhtmlDriver.Convert(String wkhtmlPath, String
switches, String html, String wkhtmlExe)
at Rotativa.NetCore.AsPdfResultBase.WkhtmlConvert(String switches)
at Rotativa.NetCore.AsResultBase.BuildFile(ActionContext context)
at Rotativa.NetCore.AsResultBase.ExecuteResult(ActionContext context)
at Microsoft.AspNetCore.Mvc.ActionResult.ExecuteResultAsync(ActionContext
context)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.
<InvokeResultAsync>d__30.MoveNext()发布于 2017-12-21 03:15:14
错误是因为Rotativa.NetCore找不到创建pdf文件所必需的文件文件夹。
如果您没有将Rotativa的文件夹复制到您的Debug或Rotativa文件夹(取决于您的配置),请执行它。它必须解决你的问题。
https://stackoverflow.com/questions/47042229
复制相似问题