首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在ASP.NET核中使用Rotativa

在ASP.NET核中使用Rotativa
EN

Stack Overflow用户
提问于 2017-10-31 18:25:44
回答 1查看 2.2K关注 0票数 0

我尝试在ASP.NET核心中使用Rotativa,这是我的代码。

代码语言:javascript
复制
    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

但它给了我一个错误:

代码语言:javascript
复制
    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()
EN

回答 1

Stack Overflow用户

发布于 2017-12-21 03:15:14

错误是因为Rotativa.NetCore找不到创建pdf文件所必需的文件文件夹。

如果您没有将Rotativa的文件夹复制到您的Debug或Rotativa文件夹(取决于您的配置),请执行它。它必须解决你的问题。

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/47042229

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档