IRONSOFTWAREHOME
CSHTML을 PDF로 변환(MVC 코어)

// PM > Install-Package IronPdf.Extensions.Mvc.Core

public async Task<IActionResult> Persons()
{
    var persons = new List<Person>
    {
    new Person { Name = "Alice", Title = "Mrs.", Description = "Software Engineer" },
    new Person { Name = "Bob", Title = "Mr.", Description = "Software Engineer" },
    new Person { Name = "Charlie", Title = "Mr.", Description = "Software Engineer" }
    };
    if (_httpContextAccessor.HttpContext.Request.Method == HttpMethod.Post.Method)
    {
        ChromePdfRenderer renderer = new ChromePdfRenderer();

        // Render View to PDF document
        PdfDocument pdf = renderer.RenderRazorViewToPdf(_viewRenderService, "Views/Home/Persons.cshtml", persons);
        Response.Headers.Add("Content-Disposition", "inline");

        // Output PDF document
        return File(pdf.BinaryData, "application/pdf", "viewToPdfMVCCore.pdf");
    }
    return View(persons);
}
Public Async Function Persons() As Task(Of IActionResult)
    Dim persons = New List(Of Person) From {
        New Person With {.Name = "Alice", .Title = "Mrs.", .Description = "Software Engineer"},
        New Person With {.Name = "Bob", .Title = "Mr.", .Description = "Software Engineer"},
        New Person With {.Name = "Charlie", .Title = "Mr.", .Description = "Software Engineer"}
    }

    If _httpContextAccessor.HttpContext.Request.Method = HttpMethod.Post.Method Then
        Dim renderer As New ChromePdfRenderer()

        ' Render View to PDF document
        Dim pdf As PdfDocument = renderer.RenderRazorViewToPdf(_viewRenderService, "Views/Home/Persons.cshtml", persons)
        Response.Headers.Add("Content-Disposition", "inline")

        ' Output PDF document
        Return File(pdf.BinaryData, "application/pdf", "viewToPdfMVCCore.pdf")
    End If

    Return View(persons)
End Function
NuGet Download
PM > Install-Package IronPdf
CSHTML을 PDF로 변환(MVC 코어)

CSHTML을 PDF로 변환(MVC 코어)

이 코드 예제는 뷰를 PDF로 변환하는 과정을 보여줍니다.

두 패키지, IronPdf.Extensions.Mvc.CoreIronPdf,는 뷰를 PDF로 렌더링할 수 있도록 함께 작동합니다. IronPdf.Extensions.Mvc.Core 패키지는 IronPdf에 대한 확장 기능으로서 뷰를 PDF로 렌더링할 수 있게 합니다.

뷰를 PDF로 렌더링하려면 RenderRazorViewToPdf 메서드를 사용하세요. 이 메서드에는 IRazorViewRenderer, ".cshtml" 파일 경로 및 ".cshtml" 파일에 표시할 데이터가 필요합니다. 더 많은 정보를 얻기 위해 ASP.NET Core MVC에서 뷰를 PDF로 변환하는 방법 문서를 방문하십시오.

이 작업을 통해 IronPDF로 PDF에 페이지 번호 적용, IronPDF로 텍스트 및 HTML 헤더와 푸터 추가, PDF 용지 크기 사용자 정의 등의 RenderingOptions 클래스가 제공하는 전체 기능 범위에 접근할 수 있습니다. 결과 PDF 문서는 필요에 따라 추가로 편집하거나 내보낼 수 있습니다.

ASP.NET MVC Core에서 CSHTML 뷰를 PDF로 변환하는 방법을 알아보세요.
GitHub에서 보기

시작할 준비 되셨나요?

Nuget Downloads 20,756,830버전:2026.7방금 출시

Key in blue circle

무료 30일 체험 키를 즉시 받으세요.

Your trial license will be sent to your email address

제한 없음. 100% 무제한 이용. 신용카드 불필요.

bullet_checked신용카드나 계정 생성은 필요하지 않습니다.제한 없음. 100% 무제한 이용. 신용카드 불필요.
  • Logo Aetna
  • Logo NASA
  • Logo GE
  • Logo Porsche
  • Logo USDA
  • Logo Qatar
Join Millions of Engineers who’ve tried IronPDF
무료 라이브 데모를 예약하세요
Booking Badge

전 세계 수백만 엔지니어들이 신뢰하는 제품입니다.

Iron Software의 고객 로고
부담 없는 무료 상담을 받아보세요
아래 양식을 작성하시거나 sales@ironsoftware.com으로 이메일을 보내주세요.
고객님의 정보는 항상 비밀로 유지됩니다.
전 세계 수백만 엔지니어들이 신뢰하는 제품입니다.
Iron Software의 고객 로고
지금 바로 30일 무료 체험판 키를 받으세요.
신용카드나 계정 생성은 필요하지 않습니다.