问题标签 [razorpdf]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
181 浏览

asp.net-mvc - 使用 RazorPDF 转换视图时出错

我建立这种格式的链接:http://localhost:33333/Invoices/Reports?format=pdf

当我运行这显示此错误:

System.InvalidOperationException:传入字典的模型项的类型为'System.Data.Entity.Infrastructure.DbQuery 1[<>f__AnonymousType911[Webb.Models.Faktury,System.Int32,System.String,System.Nullable 1[System.DateTime],System.Nullable1[System.DateTime], System.Nullable 1[System.Single],System.Nullable1[System.Int32],System.String,System.Nullable 1[System.Single],System.Nullable1[System.Single],System.Nullable 1[System.Single]]]', but this dictionary requires a model item of type 'System.Collections.Generic.List1[Webb.Models.Faktury]'。

看法:

控制器:

我应该怎么做才能使用数据库中的数据将成功视图导出为 pdf?

--编辑1:

0 投票
1 回答
14 浏览

razorpdf - 在 RazorPDF2 中更改页面方向

我正在尝试使用 NuGet 包 RazorPDF2 将 Razor View 转换为 PDF。该工具工作得非常好,并且很容易用于渲染 PDF,但我不知道如何将页面方向更改为横向。

我正在使用非常简单的控制器代码来测试到 PDF 的转换。转换有效,但我无法更改方向。

“PdfActionResult”方法确实有一个重载,看起来它可能需要配置设置,但我不知道如何使用它,因为参数是一个“封装”“Action”:

有没有人对这个工具有任何经验或者可以帮助弄清楚“configurationSettings”参数需要什么,请帮忙。谢谢!