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 安裝用於將 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 查看許可證