从View - MVC3渲染PDF之前删除“打印”按钮

时间:2017-03-08 04:12:44

标签: asp.net-mvc pdf rotativa

来自Removing a "Print" button Before Rendering PDF from View - MVC3

enter image description here

任何人都可以提供这个答案的控制器部分吗?

提前致谢.. Merin

1 个答案:

答案 0 :(得分:0)

我认为没有人可以提供控制器,但这里有一些可以提供帮助的东西。您可以为此安装Rotativa ,然后创建两个操作,如

public ActionResult Page(int id)
{

    var data =  //here you will get data from database by id
    return View(data);
}

public ActionResult PrintPage(int Id)
{
  return new ActionAsPdf(
                 "Page", 
                 new { id= Id}) 
                 { FileName = "Page.pdf" };
}

此外,还会显示名称Page的视图,data将填充returnaction Page视图pdf将转换为A = [float(v) for v in ['33.33', '33.33', '33.33', '33.37']] }}

相关问题