푸터 콘텐츠로 바로가기
IRONPDF 사용

PDF Converter .NET (Developer Tutorial)

1.0 Introduction

Adobe's Portable Document Format (PDF) is widely used for document viewing and exchange. Developers often need to create PDFs to meet client needs, and modern libraries have simplified this process. When selecting a library for a project, it's important to consider features like build, read, and conversion capabilities.

2.0 IronPDF Features

IronPDF is a versatile library for creating, reading, and editing PDF documents, with capabilities to convert HTML to PDF using the Chrome engine. It supports a wide range of web components and can be used with both ASP.NET Web Applications and traditional Windows Applications. The library allows the creation of visually appealing PDFs using HTML5, JavaScript, CSS, and images, and includes a powerful HTML-to-PDF converter.

3.0 Create PDF Documents from URLs

Generating PDF files from web pages is easy with IronPDF's built-in Chrome browser and API library. Simply provide the URL and convert it to a PDF file using the IronPDF API library. Document conversion can be completed quickly with just a few lines of code:

// 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");
$vbLabelText   $csharpLabel

The RenderUrlAsPdf method can be used to quickly convert a URL into a PDF document. Simply provide the URL and the desired save location, and IronPDF will generate the PDF file according to the information provided above. This makes it easy to convert web pages into PDF documents with just a few lines of code.

PDF Converter .NET (Developer Tutorial), Figure 1: The generated PDF file from a Google URL The generated PDF file from a Google URL

4.0 Create a PDF from HTML Strings

HTML strings can be quickly converted into PDF files using the IronPDF API library. The following code snippet can turn HTML strings into documents and can translate any HTML tag into a PDF file.

// 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");
$vbLabelText   $csharpLabel

This code snippet illustrates how to use the RenderHtmlAsPdf function to convert HTML text into a PDF. The function that converts HTML into a string accepts as much HTML code as needed. Then the process can be quickly and easily completed by using the SaveAs feature to save the document.

PDF Converter .NET (Developer Tutorial), Figure 2: The output PDF file from an HTML string The output PDF file from an HTML string

5.0 Create a PDF File from an HTML File

The IronPDF API library allows for the rapid conversion of HTML files into PDF files. Any HTML tag may be converted into a PDF file using the following sample code.

// 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");
$vbLabelText   $csharpLabel

The HTML text is as below:

<p style="color:red">Hello world</p>
<p style="color:red">Hello world</p>
HTML

PDF Converter .NET (Developer Tutorial), Figure 3: The output PDF file from an HTML file The output PDF file from an HTML file

6.0 Create a PDF File from a Rich Text File

The IronPDF API library also allows for fast PDF creation from Rich Text Files (RTFs). The sample code for converting RTFs to PDFs can be utilized to convert any number of RTFs into a single PDF file. The code is provided below.

// 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");
$vbLabelText   $csharpLabel

PDF Converter .NET (Developer Tutorial), Figure 4: The output PDF file from an RTF file The output PDF file from an RTF file

In the image above, the left side shows the source document, while the right side displays the PDF file after conversion. Additionally, we can utilize the RTF string to create a PDF by using the code provided below.

// 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");
$vbLabelText   $csharpLabel

7.0 Create a PDF File from a Markdown File

Quick PDF production from markdown files is possible thanks to the IronPDF API module. Any number of Markdown files can be converted into a PDF file using the sample code for the conversion, shown below.

// 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");
$vbLabelText   $csharpLabel

PDF Converter .NET (Developer Tutorial), Figure 5: The output PDF file from a Markdown file The output PDF file from a Markdown file

As shown in the image above, the source document is on the left, and the converted PDF file is on the right. The code provided below enables the conversion of an MD string to a PDF. For further information on HTML conversion using IronPDF, please visit this 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");
$vbLabelText   $csharpLabel

For more information on how to use the IronPDF API library, refer to the developer documentation IronPDF Documentation Resource.

8.0 Conclusion

The IronPDF library provides a free license for development, and depending on the developer's needs, several licenses are available for purchase for use in a production environment. The Lite bundle has an initial price of $799 and has no ongoing costs. The licenses come with a permanent license, a 30-day money-back guarantee, a year of product support and upgrades, as well as the possibility of redistribution for SaaS and OEM. They are one-time purchases that can be used for development, staging, and production. IronPDF also offers additional time-limited free licenses and free licenses for redistribution protection. For a complete overview of pricing and licensing information for IronPDF, please visit the IronPDF Licensing Information Page.

자주 묻는 질문

.NET에서 서식을 잃지 않고 HTML을 PDF로 변환하려면 어떻게 해야 하나요?

IronPDF를 사용하면 Chrome 엔진을 활용하여 서식을 잃지 않고 HTML을 PDF로 변환할 수 있습니다. 이 라이브러리는 HTML5, JavaScript, CSS를 지원하므로 PDF의 원래 레이아웃과 디자인을 유지할 수 있습니다.

URL을 PDF로 변환하는 데 사용할 수 있는 방법은 무엇인가요?

IronPDF는 ChromePdfRenderer 클래스를 사용하여 URL을 PDF 문서로 간단하게 변환할 수 있는 RenderUrlAsPdf 메서드를 제공합니다.

C#에서 마크다운을 PDF로 변환하는 방법이 있나요?

예, IronPDF는 RenderMarkdownFileAsPdf 메서드를 사용하여 마크다운 파일을 PDF로 변환할 수 있습니다. 이를 통해 개발자는 마크다운 콘텐츠를 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년간의 제품 업데이트 및 지원을 제공합니다.

ASP.NET 웹 및 Windows 애플리케이션에서 IronPDF를 사용할 수 있나요?

예, IronPDF는 ASP.NET 웹 애플리케이션 및 기존 Windows 애플리케이션과 모두 호환되므로 다양한 환경에서 작업하는 개발자에게 유연성을 제공합니다.

IronPDF는 암호로 보호된 PDF 파일을 지원하나요?

IronPDF는 사용자가 이러한 문서를 읽고 편집하는 데 필요한 자격 증명을 제공하도록 허용하여 암호로 보호된 PDF 파일을 처리할 수 있습니다.

.NET 10: IronPDF는 .NET 10을 대상으로 하는 프로젝트를 완벽하게 지원하나요?

예. IronPDF는 데스크톱, 웹, 마이크로서비스, 클라우드/컨테이너 환경 전반에서 새로운 런타임 및 C# 언어 개선 사항을 포함하여 .NET 10과 완벽하게 호환됩니다. 해결 방법이나 사용자 지정 API 없이도 .NET 10 프로젝트에서 바로 사용할 수 있습니다.

커티스 차우
기술 문서 작성자

커티스 차우는 칼턴 대학교에서 컴퓨터 과학 학사 학위를 취득했으며, Node.js, TypeScript, JavaScript, React를 전문으로 하는 프론트엔드 개발자입니다. 직관적이고 미적으로 뛰어난 사용자 인터페이스를 만드는 데 열정을 가진 그는 최신 프레임워크를 활용하고, 잘 구성되고 시각적으로 매력적인 매뉴얼을 제작하는 것을 즐깁니다.

커티스는 개발 분야 외에도 사물 인터넷(IoT)에 깊은 관심을 가지고 있으며, 하드웨어와 소프트웨어를 통합하는 혁신적인 방법을 연구합니다. 여가 시간에는 게임을 즐기거나 디스코드 봇을 만들면서 기술에 대한 애정과 창의성을 결합합니다.