CSHTML을 PDF로 변환(MVC 코어)
이 코드 예제는 뷰를 PDF로 변환하는 과정을 보여줍니다.
IronPdf.Extensions.Mvc.Core 및 IronPdf 두 패키지는 함께 작동하여 뷰를 PDF로 렌더링할 수 있도록 합니다. IronPdf.Extensions.Mvc.Core 패키지는 IronPdf의 확장 기능으로, 뷰를 PDF로 렌더링할 수 있도록 합니다.
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.
ASP.NET MVC Core에서 CSHTML 파일을 PDF로 변환하는 방법
- C#에서 CSHTML 파일을 PDF로 변환하는 C# 라이브러리를 설치하세요.
- `ChromePdfRenderer` 클래스의 인스턴스를 생성합니다.
- 렌더링에는 `RenderRazorViewToPdf` 메서드를 사용하십시오.
- `IRazorViewRenderer` 객체와 CSHTML 파일 경로를 메서드에 전달하세요.
- 생성된 PDF 문서를 바탕화면에 다운로드하세요.

