IronPdf.Extensions.Mvc.Core
2024.5.2
Prefix Reserved
dotnet add package IronPdf.Extensions.Mvc.Core --version 2024.5.2
NuGet\Install-Package IronPdf.Extensions.Mvc.Core -Version 2024.5.2
<PackageReference Include="IronPdf.Extensions.Mvc.Core" Version="2024.5.2" />
paket add IronPdf.Extensions.Mvc.Core --version 2024.5.2
#r "nuget: IronPdf.Extensions.Mvc.Core, 2024.5.2"
// Install IronPdf.Extensions.Mvc.Core as a Cake Addin #addin nuget:?package=IronPdf.Extensions.Mvc.Core&version=2024.5.2 // Install IronPdf.Extensions.Mvc.Core as a Cake Tool #tool nuget:?package=IronPdf.Extensions.Mvc.Core&version=2024.5.2
IronPdf Extensions Package for MVC .NET Core
Compatibility
Supports web applications and websites developed with MVC design pattern in
- .NET Core 2, 3 (and above) for Windows, Linux, macOS and Azure
- .NET 8
- .NET 7
- .NET 6
- .NET 5
The IronPDF MVC .NET Core extension provides MVC utility methods, such as RenderRazorViewToPdf
, to convert Views into PDF documents in an ASP.NET Core Web App (Model-View-Controller) project. The main IronPdf package is also required for this functionality.
Please visit "How to Convert Views to PDFs in ASP.NET Core MVC" for a comprehensive guide on how to use the package.
C# Code Example
using AutoFixture;
using Microsoft.AspNetCore.Mvc;
using Models;
using IronPdf.Extensions.Mvc.Core;
namespace IronPdf.MVC.Core.Extention.Demo.Controllers
{
public class PersonController : Controller
{
private readonly ILogger<PersonController> _logger;
private readonly IRazorViewRenderer _viewRenderService;
private readonly IHttpContextAccessor _httpContextAccessor;
public PersonController(ILogger<PersonController> logger, IRazorViewRenderer viewRenderService, IHttpContextAccessor httpContextAccessor)
{
_logger = logger;
_viewRenderService = viewRenderService;
_httpContextAccessor = httpContextAccessor;
}
public async Task<IActionResult> Persons()
{
var _fixture = new Fixture();
var persons = _fixture.CreateMany<Person>(20);
if (_httpContextAccessor.HttpContext.Request.Method == HttpMethod.Post.Method)
{
var renderer = new ChromePdfRenderer();
PdfDocument pdf = renderer.RenderRazorViewToPdf(_viewRenderService,"Views/Person/Persons.cshtml", persons);
Response.Headers.Add("Content-Disposition", "inline");
return File(pdf.BinaryData, "application/pdf");
}
return View(persons);
}
}
}
Note: This package installs only as an extension, and you also need to install the IronPDF package to use it in your application.
Documentation
- Code Samples : https://ironpdf.com/examples/cshtml-to-pdf-mvc-core/
- How-to : https://ironpdf.com/how-to/cshtml-to-pdf-mvc-core/
- MSDN Class Reference : https://ironpdf.com/c%23-pdf-documentation/
- Licensing : https://ironpdf.com/licensing/
- Live Chat Support : https://ironpdf.com/#helpscout-support
For more support and inquiries, please email us at: support@ironsoftware.com
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
This package has no dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
* Fix issue with external resource loading