CSHTML到PDF (MVC Core) 该代码示例演示了将视图转换为PDF的过程。 两个软件包 IronPdf.Extensions.Mvc.Core 和 IronPdf 协同工作,以实现将视图渲染为 PDF。 IronPdf.Extensions.Mvc.Core 包是 IronPdf 的扩展,能够将视图渲染为 PDF。 Use the RenderRazorViewToPdf method to render Views to PDFs. This method requires an IRazorViewRenderer, the path to the ".cshtml" file, and the data required to display on the ".cshtml" file. Please visit the How to Convert View to PDF in ASP.NET Core MVC how-to article to learn more. This action also enables you to access the full range of features provided by the RenderingOptions class, such as applying page numbers in PDFs with IronPDF, adding text and HTML headers and footers with IronPDF, and customizing PDF paper size. The resulting PDF document can be further edited or exported as needed. 如何在 ASP.NET MVC Core 中将 CSHTML 文件转换为 PDF 安装用 C# 将 CSHTML 文件转换为 PDF 的 C# 库。 实例化 `ChromePdfRenderer` 类 使用 `RenderRazorViewToPdf` 方法呈现 向方法传递 `IRazorViewRenderer` 对象和 CSHTML 文件路径 将生成的 PDF 文档下载到桌面 学习在 ASP.NET MVC Core 中将 CSHTML 视图转换为 PDF。 在 GitHub 上查看 代码 https://github.com/iron-software/IronPDF.Examples/tree/main/examples/cshtml-to-pdf-mvc-core 下载 ZIP 相关教程 相关操作指南 类文档 获取语言包 下载IronPDF DLL 报告此页面的问题 准备开始了吗? Nuget 下载 17,803,474 | 版本: 2026.3 刚刚发布 免费试用 免费 NuGet 下载 总下载量:17,803,474 查看许可证 还在滚动吗? 想快速获得证据? PM > Install-Package IronPdf 运行示例看着你的HTML代码变成PDF文件。 免费 NuGet 下载 总下载量:17,803,474 查看许可证