CSHTML para PDF (MVC Core)

Este exemplo de código demonstra o processo de conversão de Views em PDFs.

Dois pacotes, IronPdf.Extensions.Mvc.Core e IronPdf, trabalham em conjunto para permitir a renderização de Views em PDFs. O pacote IronPdf.Extensions.Mvc.Core serve como uma extensão do IronPdf, permitindo a renderização de Views em 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.

Aprenda a converter visualizações CSHTML em PDFs no ASP.NET MVC Core.

Pronto para começar?
Nuget Downloads 18,332,619 | Versão: 2026.4 acaba de ser lançado
Still Scrolling Icon

Ainda está rolando a tela?

Quer provas rápidas? PM > Install-Package IronPdf
executar um exemplo Veja seu HTML se transformar em um PDF.