PDF 변환기 .NET (개발자 튜토리얼)
1.0 서론
Adobe의 포터블 문서 형식(PDF)은 문서 보기 및 교환에 널리 사용됩니다. 개발자는 종종 클라이언트의 요구를 충족하기 위해 PDF를 생성해야 하며, 현대적인 라이브러리는 이 과정을 단순화했습니다. 프로젝트를 위해 라이브러리를 선택할 때에는 빌드, 읽기 및 변환 기능과 같은 기능을 고려하는 것이 중요합니다.
2.0 IronPDF 기능
IronPDF는 Chrome 엔진을 사용하여 HTML을 PDF로 변환할 수 있는 PDF 문서 생성, 읽기 및 편집을 위한 다용도 라이브러리입니다. ASP.NET 웹 응용 프로그램과 전통적인 Windows 애플리케이션 모두에서 사용할 수 있는 다양한 웹 구성 요소를 지원합니다. 라이브러리는 HTML5, JavaScript, CSS, 이미지를 사용하여 시각적으로 매력적인 PDF를 생성할 수 있으며, 강력한 HTML-to-PDF 변환기가 포함되어 있습니다.
- IronPDF 라이브러리는 이미지 파일을 PDF로 변환, HTML5를 PDF로 변환, ASPX를 PDF로 변환, 및 Razor/MVC 뷰 변환을 포함한 PDF 제작을 위한 다양한 입력을 지원합니다.
- 라이브러리에는 인터랙티브한 PDF 파일을 생성하고, 인터렉티브 폼을 편집 및 전송, PDF 파일을 나누고 텍스트 및 이미지 추출, 텍스트 검색, PDF 페이지를 이미지로 래스터화할 수 있는 도구가 포함되어 있습니다.
- 라이브러리는 URL을 PDF 문서의 기초로 사용할 수 있게 하며, 사용자 에이전트, 프록시, 쿠키, HTTP 헤더, HTML 로그인 폼 뒤의 인증을 위한 폼 변수를 지원합니다.
- IronPDF는 사용자 이름과 비밀번호를 제공하여 비밀번호로 보호된 PDF 파일에 접근할 수 있습니다.
- 라이브러리는 기존 PDF 문서의 읽기 및 편집을 지원합니다.
- IronPDF를 사용하여 PDF 문서에 텍스트, 그래픽을 추가하고, 북마크를 구성, 워터마크, 머리글 및 바닥글을 사용자 정의하며, PDF 파일에서 이미지를 추출할 수 있습니다.
- IronPDF는 새로운 또는 기존 PDF 문서의 페이지를 분할하고 병합할 수 있으며, Adobe Acrobat Reader 없이 텍스트로부터 PDF 객체를 생성할 수 있습니다.
- CSS 미디어 파일 및 CSS 파일을 PDF로 변환할 수 있습니다.
- IronPDF를 사용하여 새로운 작성 가능한 PDF 양식을 추가하거나 기존 양식을 작성할 수 있습니다.
- IronPDF는 또한 PDF 페이지를 JPEG, PNG 등과 같은 다양한 이미지 형식으로 변환할 수 있습니다.
3.0 URL에서 PDF 문서 생성
웹 페이지에서 PDF 파일을 생성하는 것은 IronPDF의 내장된 Chrome 브라우저 및 API 라이브러리로 간단합니다. URL을 제공하고 IronPDF API 라이브러리를 통해 PDF 파일로 변환하세요. 문서 변환은 몇 줄의 코드로 신속하게 완료될 수 있습니다:
// Create a new instance of the ChromePdfRenderer class
var renderer = new IronPdf.ChromePdfRenderer();
// Convert the specified URL to a PDF
var pdf = renderer.RenderUrlAsPdf("https://www.google.co.in/");
// Save the PDF to the specified path
pdf.SaveAs("result.pdf");
// Create a new instance of the ChromePdfRenderer class
var renderer = new IronPdf.ChromePdfRenderer();
// Convert the specified URL to a PDF
var pdf = renderer.RenderUrlAsPdf("https://www.google.co.in/");
// Save the PDF to the specified path
pdf.SaveAs("result.pdf");
' Create a new instance of the ChromePdfRenderer class
Dim renderer = New IronPdf.ChromePdfRenderer()
' Convert the specified URL to a PDF
Dim pdf = renderer.RenderUrlAsPdf("https://www.google.co.in/")
' Save the PDF to the specified path
pdf.SaveAs("result.pdf")
이 RenderUrlAsPdf 메서드는 URL을 PDF 문서로 빠르게 변환하는 데 사용할 수 있습니다. URL과 원하는 저장 위치를 제공하면 IronPDF가 위에서 제공된 정보에 따라 PDF 파일을 생성합니다. 이는 몇 줄의 코드로 웹 페이지를 PDF 문서로 쉽게 변환할 수 있게 해줍니다.
Google URL에서 생성된 PDF 파일
4.0 HTML 문자열에서 PDF 생성
HTML 문자열은 IronPDF API 라이브러리를 사용하여 PDF 파일로 빠르게 변환할 수 있습니다. 다음 코드 조각은 HTML 문자열을 문서로 변환하며, 모든 HTML 태그를 PDF 파일로 변환할 수 있습니다.
// Create a new instance of the ChromePdfRenderer class
var renderer = new IronPdf.ChromePdfRenderer();
// Convert the specified HTML string to a PDF
var pdf = renderer.RenderHtmlAsPdf("<p>Hello world!!</p>");
// Save the PDF to the specified path
pdf.SaveAs("result.pdf");
// Create a new instance of the ChromePdfRenderer class
var renderer = new IronPdf.ChromePdfRenderer();
// Convert the specified HTML string to a PDF
var pdf = renderer.RenderHtmlAsPdf("<p>Hello world!!</p>");
// Save the PDF to the specified path
pdf.SaveAs("result.pdf");
' Create a new instance of the ChromePdfRenderer class
Dim renderer = New IronPdf.ChromePdfRenderer()
' Convert the specified HTML string to a PDF
Dim pdf = renderer.RenderHtmlAsPdf("<p>Hello world!!</p>")
' Save the PDF to the specified path
pdf.SaveAs("result.pdf")
이 코드 스니펫은 HTML 텍스트를 PDF로 변환하는 RenderHtmlAsPdf 함수를 사용하는 방법을 보여줍니다. HTML을 문자열로 변환하는 함수는 필요한 만큼의 HTML 코드를 수용할 수 있습니다. 그런 다음 SaveAs 기능을 사용하여 문서를 저장하면 프로세스를 빠르고 쉽게 완료할 수 있습니다.
HTML 문자열에서 생성된 PDF 파일
5.0 HTML 파일에서 PDF 파일 생성
IronPDF API 라이브러리를 사용하면 HTML 파일을 PDF 파일로 빠르게 변환할 수 있습니다. 다음 샘플 코드를 사용하여 모든 HTML 태그를 PDF 파일로 변환할 수 있습니다.
// Create a new instance of the ChromePdfRenderer class
var renderer = new IronPdf.ChromePdfRenderer();
// Convert the specified HTML file to a PDF
var pdf = renderer.RenderHtmlFileAsPdf("test.html");
// Save the PDF to the specified path
pdf.SaveAs("result.pdf");
// Create a new instance of the ChromePdfRenderer class
var renderer = new IronPdf.ChromePdfRenderer();
// Convert the specified HTML file to a PDF
var pdf = renderer.RenderHtmlFileAsPdf("test.html");
// Save the PDF to the specified path
pdf.SaveAs("result.pdf");
' Create a new instance of the ChromePdfRenderer class
Dim renderer = New IronPdf.ChromePdfRenderer()
' Convert the specified HTML file to a PDF
Dim pdf = renderer.RenderHtmlFileAsPdf("test.html")
' Save the PDF to the specified path
pdf.SaveAs("result.pdf")
HTML 텍스트는 다음과 같습니다:
<p style="color:red">Hello world</p>
<p style="color:red">Hello world</p>
HTML 파일에서 생성된 PDF 파일
6.0 리치 텍스트 파일에서 PDF 파일 생성
IronPDF API 라이브러리를 사용하면 리치 텍스트 파일(RTF)에서 빠르게 PDF를 생성할 수 있습니다. RTF를 PDF로 변환하기 위한 샘플 코드는 여러 RTF 파일을 하나의 PDF 파일로 변환하는 데 사용할 수 있습니다. 코드는 아래에 제공됩니다.
// Create a new instance of the ChromePdfRenderer class
var renderer = new IronPdf.ChromePdfRenderer();
// Convert the specified RTF file to a PDF
var pdf = renderer.RenderRtfFileAsPdf("test.rtf");
// Save the PDF to the specified path
pdf.SaveAs("result.pdf");
// Create a new instance of the ChromePdfRenderer class
var renderer = new IronPdf.ChromePdfRenderer();
// Convert the specified RTF file to a PDF
var pdf = renderer.RenderRtfFileAsPdf("test.rtf");
// Save the PDF to the specified path
pdf.SaveAs("result.pdf");
' Create a new instance of the ChromePdfRenderer class
Dim renderer = New IronPdf.ChromePdfRenderer()
' Convert the specified RTF file to a PDF
Dim pdf = renderer.RenderRtfFileAsPdf("test.rtf")
' Save the PDF to the specified path
pdf.SaveAs("result.pdf")
RTF 파일에서 출력된 PDF 파일
위 그림에서 왼쪽은 원본 문서, 오른쪽은 변환된 PDF 파일을 보여줍니다. 또한, 아래에 제공된 코드를 사용하여 RTF 문자열을 PDF로 생성할 수 있습니다.
// Create a new instance of the ChromePdfRenderer class
var renderer = new IronPdf.ChromePdfRenderer();
// Convert the specified RTF string to a PDF
var pdf = renderer.RenderRtfStringAsPdf("{\\rtf1...}");
// Save the PDF to the specified path
pdf.SaveAs("result.pdf");
// Create a new instance of the ChromePdfRenderer class
var renderer = new IronPdf.ChromePdfRenderer();
// Convert the specified RTF string to a PDF
var pdf = renderer.RenderRtfStringAsPdf("{\\rtf1...}");
// Save the PDF to the specified path
pdf.SaveAs("result.pdf");
' Create a new instance of the ChromePdfRenderer class
Dim renderer = New IronPdf.ChromePdfRenderer()
' Convert the specified RTF string to a PDF
Dim pdf = renderer.RenderRtfStringAsPdf("{\rtf1...}")
' Save the PDF to the specified path
pdf.SaveAs("result.pdf")
7.0 마크다운 파일에서 PDF 파일 생성
IronPDF API 모듈 덕분에 마크다운 파일에서 빠른 PDF 생성이 가능합니다. 아래에 제시된 변환을 위한 샘플 코드를 사용하여 여러 개의 마크다운 파일을 PDF 파일로 변환할 수 있습니다.
// Create a new instance of the ChromePdfRenderer class
var renderer = new IronPdf.ChromePdfRenderer();
// Convert the specified Markdown file to a PDF
var pdf = renderer.RenderMarkdownFileAsPdf("Markdown.md");
// Save the PDF to the specified path
pdf.SaveAs("Markdown_result.pdf");
// Create a new instance of the ChromePdfRenderer class
var renderer = new IronPdf.ChromePdfRenderer();
// Convert the specified Markdown file to a PDF
var pdf = renderer.RenderMarkdownFileAsPdf("Markdown.md");
// Save the PDF to the specified path
pdf.SaveAs("Markdown_result.pdf");
' Create a new instance of the ChromePdfRenderer class
Dim renderer = New IronPdf.ChromePdfRenderer()
' Convert the specified Markdown file to a PDF
Dim pdf = renderer.RenderMarkdownFileAsPdf("Markdown.md")
' Save the PDF to the specified path
pdf.SaveAs("Markdown_result.pdf")
마크다운 파일에서 출력된 PDF 파일
위 그림에서 볼 수 있듯이 원본 문서는 왼쪽에 있으며 변환된 PDF 파일은 오른쪽에 있습니다. 아래에 제공된 코드를 사용하여 MD 문자열을 PDF로 변환할 수 있습니다. IronPDF를 사용한 HTML 변환에 대한 추가 정보는 이 HTML to PDF Conversion Tutorial을 방문하십시오.
// Create a new instance of the ChromePdfRenderer class
var renderer = new IronPdf.ChromePdfRenderer();
// Convert the specified Markdown string to a PDF
var pdf = renderer.RenderMarkdownStringAsPdf("# Hello world\n\nHello world");
// Save the PDF to the specified path
pdf.SaveAs("Markdown_result.pdf");
// Create a new instance of the ChromePdfRenderer class
var renderer = new IronPdf.ChromePdfRenderer();
// Convert the specified Markdown string to a PDF
var pdf = renderer.RenderMarkdownStringAsPdf("# Hello world\n\nHello world");
// Save the PDF to the specified path
pdf.SaveAs("Markdown_result.pdf");
Imports Microsoft.VisualBasic
' Create a new instance of the ChromePdfRenderer class
Dim renderer = New IronPdf.ChromePdfRenderer()
' Convert the specified Markdown string to a PDF
Dim pdf = renderer.RenderMarkdownStringAsPdf("# Hello world" & vbLf & vbLf & "Hello world")
' Save the PDF to the specified path
pdf.SaveAs("Markdown_result.pdf")
IronPDF API 라이브러리 사용 방법에 대한 자세한 정보는 개발자 설명서 IronPDF Documentation Resource를 참조하십시오.
8.0 결론
IronPDF 라이브러리는 개발을 위한 무료 라이선스를 제공하며, 개발자의 필요에 따라 프로덕션 환경에서 사용할 수 있는 여러 라이선스를 구매할 수 있습니다. Lite 번들은 시작 가격이 $799이며 지속적인 비용이 없습니다. 라이선스에는 영구 라이선스, 30일 환불 보장, 1년간 제품 지원 및 업그레이드, SaaS 및 OEM용 재배포 가능성이 포함됩니다. 개발, 스테이징, 프로덕션에서 사용할 수 있는 일회성 구매입니다. IronPDF는 추가로 기간 제한이 있는 무료 라이선스와 재배포 보호를 위한 무료 라이선스도 제공합니다. IronPDF의 가격 정보 및 라이선싱에 대한 전체 개요는 IronPDF Licensing Information Page를 방문하십시오.
자주 묻는 질문
.NET에서 HTML을 PDF로 변환하여 형식을 손실하지 않고 어떻게 할 수 있습니까?
Chrome 엔진을 활용하여 IronPDF를 사용하여 HTML을 PDF로 변환하면 형식을 손실하지 않습니다. 이 라이브러리는 HTML5, JavaScript 및 CSS를 지원하여 PDF가 원래의 레이아웃과 디자인을 유지하도록 합니다.
URL을 PDF로 변환하는 방법은 무엇입니까?
IronPDF는 RenderUrlAsPdf 메서드를 제공하여 ChromePdfRenderer 클래스와 함께 URL을 PDF 문서로 간단히 변환할 수 있습니다.
C#에서 Markdown을 PDF로 변환할 방법이 있나요?
네, IronPDF는 RenderMarkdownFileAsPdf 메서드를 사용하여 Markdown 파일을 PDF로 변환할 수 있습니다. 이를 통해 개발자가 Markdown 콘텐츠를 효율적으로 PDF 형식으로 변환할 수 있습니다.
.NET을 사용하여 RTF 파일을 PDF 문서로 변환하는 방법은 무엇입니까?
IronPDF는 RenderRtfFileAsPdf 메서드를 통해 RTF 파일을 PDF로 변환할 수 있으며, 리치 텍스트 파일을 PDF 형식으로 빠르고 정확하게 변환할 수 있습니다.
PDF 파일에서 텍스트와 이미지를 추출할 수 있나요?
네, IronPDF는 PDF 문서에서 텍스트와 이미지를 쉽게 추출할 수 있게 해주며, PDF 내에서 텍스트와 이미지를 검색하고 조작할 수 있는 기능을 제공합니다.
대화형 PDF 양식을 만들 때 사용할 수 있는 옵션은 무엇입니까?
IronPDF는 대화형 PDF 양식의 생성과 편집을 지원하여 개발자가 PDF 문서에 양식 필드, 그래픽, 북마크 및 워터마크를 추가할 수 있습니다.
.NET에서 PDF 문서를 병합하거나 분할하는 방법은 무엇입니까?
IronPDF는 PDF 문서를 병합하고 분할 할 수 있는 기능을 제공하여 개발자가 여러 PDF를 하나로 합치거나 하나의 PDF를 여러 문서로 분할할 수 있도록 합니다.
IronPDF는 제작 환경에서 사용할 수 있는 라이센스 옵션을 제공합니까?
IronPDF는 제품 환경에서 사용할 수 있는 다양한 라이센스 옵션을 제공하며, 비용이 남지 않는 Lite 번들을 포함합니다. 라이센스는 영구 사용 권리, 30일 환불 보장, 1년 간의 제품 업데이트 및 지원을 제공합니다.
IronPDF는 ASP.NET 웹 응용 프로그램과 Windows 응용 프로그램에서 사용할 수 있습니까?
네, IronPDF는 ASP.NET 웹 응용 프로그램과 전통적인 Windows 응용 프로그램 모두에서 호환 가능하여 다른 환경에서 작업하는 개발자에게 유연성을 제공합니다.
IronPDF는 비밀번호로 보호된 PDF 파일을 지원합니까?
IronPDF는 비밀번호로 보호된 PDF 파일을 처리할 수 있으며, 사용자가 필요한 인증 정보를 제공하여 이러한 문서를 읽고 편집할 수 있도록 합니다.
.NET 10: IronPDF는 .NET 10을 대상으로 하는 프로젝트를 완전히 지원합니까?
네, IronPDF는 .NET 10과 완벽하게 호환됩니다 - 새로운 런타임 및 C# 언어 개선점을 포함하여 데스크톱, 웹, 마이크로서비스, 클라우드/컨테이너 환경 전반에 걸쳐 기능합니다. .NET 10 프로젝트에 별도의 작업이나 커스텀 API 없이 바로 작동합니다.


