c# - 使用 Rotativa 从多个 View 生成 pdf?

标签 c# asp.net-mvc rotativa

我想使用 2 个 View 生成一个 pdf。我的目标是从第一个 View 生成第一页,从第二个 View 生成第二页。

这是我当前的代码:

var actionPDF = new Rotativa.ActionAsPdf("DownloadDividendSummaryPdf", new { ReportType = DividendType, Time = DividendTime })
                {
                    FileName = "DividendPortfolio" + email + ".pdf",
                    PageSize = Size.A4,
                    MinimumFontSize = 12,
                    //PageMargins = new Margins(3, 3, 3, 3),
                    IsGrayScale = true,
                    IsJavaScriptDisabled = true,
                    IsBackgroundDisabled = true,
                };

                actionPDF = new Rotativa.ActionAsPdf("DownloadDividendDetailedPdf", new { ReportType = DividendType, Time = DividendTime, StartDate = G_StartDate, todate = G_ToDate })
                {
                    FileName = "DividendPortfolio" + email + ".pdf",
                    PageSize = Size.A4,
                    MinimumFontSize = 12,
                    //PageMargins = new Margins(3, 3, 3, 3),
                    IsGrayScale = true,
                    IsJavaScriptDisabled = true,
                    IsBackgroundDisabled = true,
                };

最佳答案

要么合并 PDF(这很重要),要么简单地创建一个 View 来呈现其他两个 View 的输出,然后将那个 View 呈现为 PDF。

关于c# - 使用 Rotativa 从多个 View 生成 pdf?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48281814/

相关文章:

c# - System.Timers.Timer() 由于 Elapsed Events 的聚合而多次触发

c# - 如何在 C# 中为事件中心创建接收器以获取给定时间跨度的消息?

C#.NET 如何使用表单例份验证将 session 超时设置为 6 小时?

c# - ASP.NET MVC 上传文件超时

c# - 如何在 .NET MVC3 中拦截当前 actionresult 的输出流?

c# - 我可以在 .NET 3.5 的代码隐藏中打印标准测试页吗?

c# - 根据参数在 Razor 中切换 Case

c# - Asp MVC删除数据后如何刷新索引页

asp.net-mvc - Rotativa 和 Bootstrap 网格样式

twitter-bootstrap - 使用 rotativa PDF Bootstrap 最小规模