CSHTML to PDF (MVC Core) This code example demonstrates the process of converting Views into PDFs. Two packages, IronPdf.Extensions.Mvc.Core and IronPdf, work together to enable the rendering of Views into PDFs. The IronPdf.Extensions.Mvc.Core package serves as an extension to IronPdf, enabling the rendering of Views to PDFs. 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. How to Convert CSHTML Files to PDFs in ASP.NET MVC Core Install the C# library for converting CSHTML files to PDFs in C# Instantiate the ChromePdfRenderer class Use the RenderRazorViewToPdf method for rendering Pass an IRazorViewRenderer object and the CSHTML file path to the method Download the resulting PDF document to the desktop Learn to Convert CSHTML Views to PDFs in ASP.NET MVC Core. View on GitHub Code https://github.com/iron-software/IronPdf.Examples/tree/main/examples/cshtml-to-pdf-mvc-core Download ZIP Related Tutorial Related How-To Guide Class Documentation Get Language Packs Download IronPDF DLL Report an Issue on this page Ready to Get Started? Nuget Downloads 16,315,602 | Version: 2025.11 just released Free NuGet Download Total downloads: 16,315,602 View Licenses
All your questions are answered to make sure you have all the information you need. (No commitment whatsoever.)