How to Convert Razor View to PDF in MVC in .NET 6

preview_player
Показать описание

- Add a model class for the data
- Create a new Razor Page and edit the ".cshtml" file to display the data
- Edit the ".cs" file and use the RenderRazorToPdf method
- Download the sample project for a quick start

Learn how to simplify the process of creating PDF files directly from Razor Pages within an ASP.NET Core Web App using IronPDF. IronPDF is a powerful C# library that seamlessly integrates with ASP.NET Core, making PDF generation easy and efficient.

Tutorial Highlights:
1. Download IronPDF Library:
- Download the C# library for converting Razor pages to PDFs in ASP.NET Core Web App.
- Install the IronPdf.Extensions.Razor package using NuGet.

2. Create a Model Class:
- Set up a model class (e.g., "Person") in the "Models" folder to serve as a data model.

3. Add a Razor Page:
- Customize the Razor Page to display data in a table.

4. Edit Code-Behind for PDF Conversion:

5. Add Navigation to Top Navigation Bar:

6. Run the Project:
- Execute the ASP.NET Core Web App project to see the PDF generation in action.

7. Download Sample Project:
- Download the complete ASP.NET Core Web App project to explore and experiment.

Try it FREE for 30 days
You'll have a fully-functioning product, and be able to test and share in a live environment with no watermarks for a full 30 days.

Рекомендации по теме