IronPdf.Extensions.Razor 2024.2.18

The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org. Prefix Reserved
dotnet add package IronPdf.Extensions.Razor --version 2024.2.18
NuGet\Install-Package IronPdf.Extensions.Razor -Version 2024.2.18
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="IronPdf.Extensions.Razor" Version="2024.2.18" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add IronPdf.Extensions.Razor --version 2024.2.18
#r "nuget: IronPdf.Extensions.Razor, 2024.2.18"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install IronPdf.Extensions.Razor as a Cake Addin
#addin nuget:?package=IronPdf.Extensions.Razor&version=2024.2.18

// Install IronPdf.Extensions.Razor as a Cake Tool
#tool nuget:?package=IronPdf.Extensions.Razor&version=2024.2.18

Nuget Installs windows macOS linux microsoftazure livechat

IronPdf Extensions Package for Razor Pages

Compatibility

Supports web applications and websites developed with .Net Core Razor Pages

  • .NET Core 2, 3 (and above) for Windows, Linux, macOS and Azure
  • .NET 8
  • .NET 7
  • .NET 6
  • .NET 5

The IronPDF .NET Core Razor Pages extension provides utility methods such as RenderRazorToPdf that are used to convert Razor Pages to PDFs and require the main IronPdf package.

Please visit "How to Convert Razor Pages to PDFs in ASP.NET Core Web App" for a comprehensive guide on how to use the package.

C# Code Example

using AutoFixture;
using IronPdf.Razor.Pages;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Models;

namespace IronPdf.Razor.Page.Extension.Demo.Pages
{
    public class PersonsModel : PageModel
    {
        [BindProperty(SupportsGet = true)]
        public List<Person> persons { get; set; }

        public void OnGet()
        {
            persons = new List<Person>();
            var _fixture = new Fixture();

            persons = _fixture.CreateMany<Person>(10).ToList();
            ViewData["persionList"] = persons;
        }
        public IActionResult OnPostAsync()
        {
            persons = new List<Person>();
            var _fixture = new Fixture();

            persons = _fixture.CreateMany<Person>(10).ToList();
            ViewData["persionList"] = persons;

            ChromePdfRenderer renderer = new ChromePdfRenderer();

            PdfDocument pdf = renderer.RenderRazorToPdf(this);

            Response.Headers.Add("Content-Disposition", "inline");
            return File(pdf.BinaryData, "application/pdf");
        }
    }
}

Note: This package only installs as an extension and you need to install the IronPDF package as well to use in your application.

Documentation

For more support and inquiries, please email us at: support@ironsoftware.com

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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.

Version Downloads Last updated
2024.2.18 560 1/29/2024
2023.9.1 983 9/16/2023

* Update the package description.
* Add the method to convert Razor Page to HTML (see RenderRazorToHtml).