CSHTML a PDF (MVC Core)
Este ejemplo de código demuestra el proceso de convertir Vistas en PDFs.
Dos paquetes, IronPdf.Extensions.Mvc.Core y IronPdf, trabajan juntos para permitir la representación de vistas en archivos PDF. El paquete IronPdf.Extensions.Mvc.Core sirve como una extensión de IronPdf, lo que permite la representación de vistas en archivos 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.
Cómo convertir archivos CSHTML a PDF en ASP.NET MVC Core
- Instale la biblioteca C# para convertir archivos CSHTML a PDF en C#
- Instanciar la clase `ChromePdfRenderer`
- Utilice el método `RenderRazorViewToPdf` para renderizar
- Pase un objeto `IRazorViewRenderer` y la ruta del archivo CSHTML al método
- Descargar el documento PDF resultante al escritorio
Aprenda a convertir vistas CSHTML a PDF en ASP.NET MVC Core.

