C#에서 Pdfium에서 IronPDF로 마이그레이션하는 방법
Pdfium.NET에서 IronPDF로의 마이그레이션은 .NET PDF 워크플로우를 네이티브 이진 종속성을 가진 렌더링 중심의 라이브러리에서 플랫폼별 복잡성이 없는 생성, 조작 및 렌더링을 처리하는 종합적인 PDF 솔루션으로 이동합니다. 이 가이드는 네이티브 종속성 관리를 제거하면서, Pdfium이 제공할 수 없는 기능을 추가하는 완전한 단계별 마이그레이션 경로를 제공합니다.
왜 Pdfium에서 IronPDF로 마이그레이션해야 하는가
Pdfium.NET 이해하기
Pdfium.NET은 Google의 PDFium 라이브러리에 대한 .NET 래퍼로, PDF 문서를 렌더링하는 데 있어 효율성과 속도로 유명합니다. 이는 C# 애플리케이션 내에서 PDF 렌더링의 복잡성에 몰두하는 개발자들에게 중요한 라이브러리로 부각되었으며, .NET 환경에서 PDF 콘텐츠의 고충실도 복제를 제공합니다.
그러나 렌더링에서의 뛰어남에도 불구하고, Pdfium.NET의 PDF 문서 생성 및 조작 능력은 제한적입니다. 이는 주로 정확하게 PDF 콘텐츠를 표시해야 하는 애플리케이션을 위해 설계되었으며, 새로운 PDF를 수정하거나 생성하는 데는 덜 중점을 둡니다.
Pdfium의 주요 제한 사항
-
렌더링 전용 초점: HTML, 이미지 또는 프로그래밍적으로 PDF를 생성할 수 없습니다. Pdfium의 기능은 PDF 보기 및 렌더링으로 제한됩니다.
-
PDF 조작 불가: PDF 콘텐츠를 병합, 분할 또는 수정할 수 없습니다. PDF 병합은 기본적으로 지원되지 않으며, 다른 라이브러리(iTextSharp 또는 PdfSharp)를 사용해야 합니다.
-
네이티브 이진 종속성: 플랫폼별 PDFium 바이너리가 필요합니다. 개발자들은 네이티브 PDFium 바이너리를 관리해야 하며, 이는 배포 및 배포 시 복잡성을 추가합니다.
-
복잡한 배포: 플랫폼별로 x86, x64 및 런타임 폴더와 함께 네이티브 DLL을 번들 및 관리해야 합니다.
-
제한된 텍스트 추출: 형식이 없는 기본 텍스트 추출. 텍스트 추출은 Pdfium.NET과 함께 추가 작업이 필요합니다.
-
HTML에서 PDF로: 웹 콘텐츠를 PDF로 변환할 수 없습니다. Pdfium.NET에서는 HTML에서 PDF로 변환이 기본적으로 지원되지 않습니다.
-
헤더/푸터 없음: 페이지 번호나 반복 콘텐츠를 추가할 수 없습니다.
-
워터마크 없음: 문서에 오버레이를 추가할 수 없습니다.
-
양식 지원 없음: PDF 양식을 채우거나 읽을 수 없습니다.
- 보안 기능 없음: PDF를 암호화하거나 암호로 보호할 수 없습니다.
Pdfium vsIronPDF비교
| 측면 | Pdfium.NET | IronPDF |
|---|---|---|
| 주요 초점 | 렌더링/보기 | 완전한 PDF 솔루션 |
| 렌더링 충실도 | 고충실도 렌더링 | 고충실도, 특히 HTML/CSS/JS에서 |
| PDF 생성 | ✗ | ✓(HTML, URL, 이미지) |
| PDF 조작 | ✗ | ✓(병합, 분할, 편집) |
| HTML to PDF | ✗ | ✓(Chromium 엔진) |
| 워터마크 | ✗ | ✓ |
| 헤더/푸터 | ✗ | ✓ |
| 양식 채우기 | ✗ | ✓ |
| 보안 | ✗ | ✓ |
| 네이티브 종속성 | 필요함 | 없음 (완전 관리) |
| 크로스 플랫폼 | 복잡한 설정 | 자동 |
| 배포 용이성 | 네이티브 종속성으로 인해 복잡함 | 더 쉬움; 종속성 복잡성 감소 |
2025년과 2026년까지 .NET 10과 C# 14 채택을 계획하는 팀의 경우, IronPDF는 본격 유용한 PDF 생성 및 조작 기능을 추가하면서 네이티브 이진 관리 해제를 제공하는 완전 관리 기반을 제공합니다.
시작하기 전에
필수 조건
- .NET 환경: .NET Framework 4.6.2+ 또는 .NET Core 3.1+ / .NET 5/6/7/8/9+
- NuGet 접근 권한: NuGet 패키지를 설치할 수 있는 능력
- IronPDF 라이선스: ironpdf.com에서 라이선스 키를 획득하세요
NuGet 패키지 변경 사항
# Remove Pdfium packages
dotnet remove package Pdfium.NET
dotnet remove package Pdfium.Net.SDK
dotnet remove package PdfiumViewer
# Install IronPDF
dotnet add package IronPdf
# Remove Pdfium packages
dotnet remove package Pdfium.NET
dotnet remove package Pdfium.Net.SDK
dotnet remove package PdfiumViewer
# Install IronPDF
dotnet add package IronPdf
라이선스 구성
// Add at application startup (Program.cs or Startup.cs)
IronPdf.License.LicenseKey = "YOUR-LICENSE-KEY";
// Add at application startup (Program.cs or Startup.cs)
IronPdf.License.LicenseKey = "YOUR-LICENSE-KEY";
' Add at application startup (Program.vb or Startup.vb)
IronPdf.License.LicenseKey = "YOUR-LICENSE-KEY"
Pdfium 사용 식별
# Find Pdfium usage
grep -r "Pdfium\|PdfDocument\.Load\|\.Render\(" --include="*.cs" .
# Find native binary references
grep -r "pdfium\.dll\|pdfium\.so\|pdfium\.dylib" --include="*.csproj" --include="*.config" .
# Find platform-specific code
grep -r "#if.*64\|WIN32\|WIN64\|LINUX\|OSX" --include="*.cs" .
# Find Pdfium usage
grep -r "Pdfium\|PdfDocument\.Load\|\.Render\(" --include="*.cs" .
# Find native binary references
grep -r "pdfium\.dll\|pdfium\.so\|pdfium\.dylib" --include="*.csproj" --include="*.config" .
# Find platform-specific code
grep -r "#if.*64\|WIN32\|WIN64\|LINUX\|OSX" --include="*.cs" .
완전한 API 참조
네임스페이스 변경
// Pdfium.NET
using Pdfium;
using Pdfium.Net;
using PdfiumViewer;
// IronPDF
using IronPdf;
using IronPdf.Rendering;
using IronPdf.Editing;
// Pdfium.NET
using Pdfium;
using Pdfium.Net;
using PdfiumViewer;
// IronPDF
using IronPdf;
using IronPdf.Rendering;
using IronPdf.Editing;
Imports Pdfium
Imports Pdfium.Net
Imports PdfiumViewer
Imports IronPdf
Imports IronPdf.Rendering
Imports IronPdf.Editing
핵심 클래스 매핑
| Pdfium.NET | IronPDF |
|---|---|
PdfDocument |
PdfDocument |
PdfPage |
PdfPage |
PdfPageCollection |
PdfPageCollection |
| (사용 불가) | ChromePdfRenderer |
| (사용 불가) | HtmlHeaderFooter |
문서 로딩 매핑
| Pdfium.NET | IronPDF |
|---|---|
PdfDocument.Load(path) |
PdfDocument.FromFile(path) |
PdfDocument.Load(stream) |
PdfDocument.FromStream(stream) |
PdfDocument.Load(bytes) |
PdfDocument.FromBinaryData(bytes) |
new PdfDocument(path) |
PdfDocument.FromFile(path) |
문서 속성 매핑
| Pdfium.NET | IronPDF |
|---|---|
document.PageCount |
document.PageCount |
document.Pages |
document.Pages |
document.Pages[index] |
document.Pages[index] |
document.GetPageSize(index) |
document.Pages[index].Width/Height |
텍스트 추출 매핑
| Pdfium.NET | IronPDF |
|---|---|
document.GetPdfText(pageIndex) |
document.Pages[index].Text |
| (수동 루프) | document.ExtractAllText() |
page.GetTextBounds() |
page.Text |
문서 저장 매핑
| Pdfium.NET | IronPDF |
|---|---|
document.Save(path) |
document.SaveAs(path) |
document.Save(stream) |
document.Stream |
| (사용 불가) | document.BinaryData |
페이지 렌더링 매핑
| Pdfium.NET | IronPDF |
|---|---|
page.Render(width, height) |
pdf.RasterizeToImageFiles(path, dpi) |
page.Render(width, height, flags) |
DPI 매개변수 |
document.Render(index, width, height) |
pdf.RasterizeToImageFiles() |
page.RenderToScale(scale) |
DPI: 72 * scale |
Pdfium에서 사용 불가한 새로운 기능
| IronPDF기능 | 설명 |
|---|---|
ChromePdfRenderer.RenderHtmlAsPdf() |
HTML에서 생성 |
ChromePdfRenderer.RenderUrlAsPdf() |
URL에서 생성 |
ChromePdfRenderer.RenderHtmlFileAsPdf() |
HTML 파일에서 생성 |
PdfDocument.Merge() |
PDF 병합 |
pdf.CopyPages() |
페이지 추출 |
pdf.RemovePages() |
페이지 삭제 |
pdf.InsertPdf() |
특정 위치에 PDF 삽입 |
pdf.ApplyWatermark() |
워터마크 추가 |
pdf.AddHtmlHeaders() |
헤더 추가 |
pdf.AddHtmlFooters() |
푸터 추가 |
pdf.SecuritySettings |
암호 보호 |
pdf.SignWithDigitalSignature() |
디지털 서명 |
pdf.Form |
양식 채우기 |
코드 마이그레이션 예제
예제 1: PDF에서 텍스트 추출
전 (Pdfium):
// NuGet: Install-Package PdfiumViewer
using PdfiumViewer;
using System;
using System.IO;
using System.Text;
class Program
{
static void Main()
{
string pdfPath = "document.pdf";
using (var document = PdfDocument.Load(pdfPath))
{
StringBuilder text = new StringBuilder();
for (int i = 0; i < document.PageCount; i++)
{
// Note: PdfiumViewer has limited text extraction capabilities
// Text extraction requires additional work with Pdfium.NET
string pageText = document.GetPdfText(i);
text.AppendLine(pageText);
}
Console.WriteLine(text.ToString());
}
}
}
// NuGet: Install-Package PdfiumViewer
using PdfiumViewer;
using System;
using System.IO;
using System.Text;
class Program
{
static void Main()
{
string pdfPath = "document.pdf";
using (var document = PdfDocument.Load(pdfPath))
{
StringBuilder text = new StringBuilder();
for (int i = 0; i < document.PageCount; i++)
{
// Note: PdfiumViewer has limited text extraction capabilities
// Text extraction requires additional work with Pdfium.NET
string pageText = document.GetPdfText(i);
text.AppendLine(pageText);
}
Console.WriteLine(text.ToString());
}
}
}
Imports PdfiumViewer
Imports System
Imports System.IO
Imports System.Text
Module Program
Sub Main()
Dim pdfPath As String = "document.pdf"
Using document = PdfDocument.Load(pdfPath)
Dim text As New StringBuilder()
For i As Integer = 0 To document.PageCount - 1
' Note: PdfiumViewer has limited text extraction capabilities
' Text extraction requires additional work with Pdfium.NET
Dim pageText As String = document.GetPdfText(i)
text.AppendLine(pageText)
Next
Console.WriteLine(text.ToString())
End Using
End Sub
End Module
이후 (IronPDF):
// NuGet: Install-Package IronPdf
using IronPdf;
using System;
class Program
{
static void Main()
{
string pdfPath = "document.pdf";
var pdf = PdfDocument.FromFile(pdfPath);
string text = pdf.ExtractAllText();
Console.WriteLine(text);
}
}
// NuGet: Install-Package IronPdf
using IronPdf;
using System;
class Program
{
static void Main()
{
string pdfPath = "document.pdf";
var pdf = PdfDocument.FromFile(pdfPath);
string text = pdf.ExtractAllText();
Console.WriteLine(text);
}
}
Imports IronPdf
Imports System
Class Program
Shared Sub Main()
Dim pdfPath As String = "document.pdf"
Dim pdf = PdfDocument.FromFile(pdfPath)
Dim text As String = pdf.ExtractAllText()
Console.WriteLine(text)
End Sub
End Class
여기서의 차이는 매우 큽니다. Pdfium은 각 페이지를 GetPdfText(pageIndex)로 수동으로 반복하며 StringBuilder를 생성하고 올바른 처리를 위해 using 문을 관리해야 합니다. 코드는 'PdfiumViewer는 제한된 텍스트 추출 능력을 가지고 있으며'와 '텍스트 추출에는 추가 작업이 필요함'을 언급합니다.
IronPDF는 PdfDocument.FromFile()로 로드하고, ExtractAllText()로 추출하고, 그리고 출력하는 세 줄로 이를 간소화합니다. ExtractAllText() 메서드는 더욱 발전된 텍스트 추출 기능으로 모든 페이지를 자동으로 처리합니다. 페이지별 추출이 필요하면 pdf.Pages[index].Text를 사용할 수 있습니다. 텍스트 추출 문서에서 추가 옵션을 참조하세요.
예제 2: PDF 병합
전 (Pdfium):
// NuGet: Install-Package PdfiumViewer
using PdfiumViewer;
using System;
using System.IO;
using System.Collections.Generic;
// Note: PdfiumViewer does not have native PDF merging functionality
// You would need to use additional libraries or implement custom logic
class Program
{
static void Main()
{
List<string> pdfFiles = new List<string>
{
"document1.pdf",
"document2.pdf",
"document3.pdf"
};
// PdfiumViewer is primarily for rendering/viewing
// PDF merging is not natively supported
// You would need to use another library like iTextSharp or PdfSharp
Console.WriteLine("PDF merging not natively supported in PdfiumViewer");
}
}
// NuGet: Install-Package PdfiumViewer
using PdfiumViewer;
using System;
using System.IO;
using System.Collections.Generic;
// Note: PdfiumViewer does not have native PDF merging functionality
// You would need to use additional libraries or implement custom logic
class Program
{
static void Main()
{
List<string> pdfFiles = new List<string>
{
"document1.pdf",
"document2.pdf",
"document3.pdf"
};
// PdfiumViewer is primarily for rendering/viewing
// PDF merging is not natively supported
// You would need to use another library like iTextSharp or PdfSharp
Console.WriteLine("PDF merging not natively supported in PdfiumViewer");
}
}
Imports PdfiumViewer
Imports System
Imports System.IO
Imports System.Collections.Generic
' Note: PdfiumViewer does not have native PDF merging functionality
' You would need to use additional libraries or implement custom logic
Class Program
Shared Sub Main()
Dim pdfFiles As New List(Of String) From {
"document1.pdf",
"document2.pdf",
"document3.pdf"
}
' PdfiumViewer is primarily for rendering/viewing
' PDF merging is not natively supported
' You would need to use another library like iTextSharp or PdfSharp
Console.WriteLine("PDF merging not natively supported in PdfiumViewer")
End Sub
End Class
이후 (IronPDF):
// NuGet: Install-Package IronPdf
using IronPdf;
using System;
using System.Collections.Generic;
class Program
{
static void Main()
{
List<string> pdfFiles = new List<string>
{
"document1.pdf",
"document2.pdf",
"document3.pdf"
};
var pdf = PdfDocument.Merge(pdfFiles);
pdf.SaveAs("merged.pdf");
Console.WriteLine("PDFs merged successfully");
}
}
// NuGet: Install-Package IronPdf
using IronPdf;
using System;
using System.Collections.Generic;
class Program
{
static void Main()
{
List<string> pdfFiles = new List<string>
{
"document1.pdf",
"document2.pdf",
"document3.pdf"
};
var pdf = PdfDocument.Merge(pdfFiles);
pdf.SaveAs("merged.pdf");
Console.WriteLine("PDFs merged successfully");
}
}
Imports IronPdf
Imports System
Imports System.Collections.Generic
Module Program
Sub Main()
Dim pdfFiles As New List(Of String) From {
"document1.pdf",
"document2.pdf",
"document3.pdf"
}
Dim pdf = PdfDocument.Merge(pdfFiles)
pdf.SaveAs("merged.pdf")
Console.WriteLine("PDFs merged successfully")
End Sub
End Module
이 예제는 기본 기능 격차를 강조합니다. Pdfium은 PDF를 병합할 수 없습니다 - 코드는 명시적으로 'PdfiumViewer에서는 PDF 병합이 기본적으로 지원되지 않습니다'와 'PdfSharp 또는 iTextSharp 같은 다른 라이브러리를 사용해야 합니다'라고 언급합니다.
IronPDF는 파일 경로 목록을 직접 받아들이는 정적 PdfDocument.Merge() 메서드로 네이티브 병합을 제공합니다. 결과는 SaveAs()로 저장하는 새로운 PdfDocument입니다. PDF 병합 및 분할에 대해 더 알아보세요.
예제 3: HTML에서 PDF로 변환
전 (Pdfium):
// NuGet: Install-Package PdfiumViewer
using PdfiumViewer;
using System.IO;
using System.Drawing.Printing;
// Note: PdfiumViewer is primarily for viewing/rendering PDFs, not creating them from HTML
// For HTML to PDF with Pdfium.NET, you would need additional libraries
// This example shows a limitation of Pdfium.NET
class Program
{
static void Main()
{
// Pdfium.NET does not have native HTML to PDF conversion
// You would need to use a separate library to convert HTML to PDF
// then use Pdfium for manipulation
string htmlContent = "<h1>Hello World</h1>";
// This functionality is not directly available in Pdfium.NET
Console.WriteLine("HTML to PDF conversion not natively supported in Pdfium.NET");
}
}
// NuGet: Install-Package PdfiumViewer
using PdfiumViewer;
using System.IO;
using System.Drawing.Printing;
// Note: PdfiumViewer is primarily for viewing/rendering PDFs, not creating them from HTML
// For HTML to PDF with Pdfium.NET, you would need additional libraries
// This example shows a limitation of Pdfium.NET
class Program
{
static void Main()
{
// Pdfium.NET does not have native HTML to PDF conversion
// You would need to use a separate library to convert HTML to PDF
// then use Pdfium for manipulation
string htmlContent = "<h1>Hello World</h1>";
// This functionality is not directly available in Pdfium.NET
Console.WriteLine("HTML to PDF conversion not natively supported in Pdfium.NET");
}
}
Imports PdfiumViewer
Imports System.IO
Imports System.Drawing.Printing
' Note: PdfiumViewer is primarily for viewing/rendering PDFs, not creating them from HTML
' For HTML to PDF with Pdfium.NET, you would need additional libraries
' This example shows a limitation of Pdfium.NET
Class Program
Shared Sub Main()
' Pdfium.NET does not have native HTML to PDF conversion
' You would need to use a separate library to convert HTML to PDF
' then use Pdfium for manipulation
Dim htmlContent As String = "<h1>Hello World</h1>"
' This functionality is not directly available in Pdfium.NET
Console.WriteLine("HTML to PDF conversion not natively supported in Pdfium.NET")
End Sub
End Class
이후 (IronPDF):
// NuGet: Install-Package IronPdf
using IronPdf;
using System;
class Program
{
static void Main()
{
var renderer = new ChromePdfRenderer();
string htmlContent = "<h1>Hello World</h1>";
var pdf = renderer.RenderHtmlAsPdf(htmlContent);
pdf.SaveAs("output.pdf");
Console.WriteLine("PDF created successfully");
}
}
// NuGet: Install-Package IronPdf
using IronPdf;
using System;
class Program
{
static void Main()
{
var renderer = new ChromePdfRenderer();
string htmlContent = "<h1>Hello World</h1>";
var pdf = renderer.RenderHtmlAsPdf(htmlContent);
pdf.SaveAs("output.pdf");
Console.WriteLine("PDF created successfully");
}
}
Imports IronPdf
Imports System
Class Program
Shared Sub Main()
Dim renderer = New ChromePdfRenderer()
Dim htmlContent As String = "<h1>Hello World</h1>"
Dim pdf = renderer.RenderHtmlAsPdf(htmlContent)
pdf.SaveAs("output.pdf")
Console.WriteLine("PDF created successfully")
End Sub
End Class
이 예제는 가장 중요한 기능 차이를 보여줍니다. Pdfium은 'Pdfium.NET에서 HTML에서 PDF로 변환이 기본적으로 지원되지 않습니다'와 'HTML을 PDF로 변환하려면 별도의 라이브러리를 사용해야 합니다'라고 명시합니다.
IronPDF는 ChromePdfRenderer을 통해 네이티브 HTML을 PDF로 변환하며, HTML, CSS 및 JavaScript의 정확한 렌더링을 위해 내부적으로 Chromium 엔진을 사용합니다. RenderHtmlAsPdf() 메서드는 HTML 문자열을 바로 PDF 문서로 변환합니다. IronPDF는 또한 RenderUrlAsPdf()로 URL을, RenderHtmlFileAsPdf()로 HTML 파일을 렌더링할 수 있습니다. HTML에서 PDF로의 문서에서 포괄적인 예제를 참조하세요.
네이티브 종속성 제거
Pdfium에서 IronPDF로 마이그레이션하는 가장 큰 이점 중 하나는 네이티브 바이너리 관리를 제거하는 것입니다.
이전 (Pdfium) - 복잡한 배포
MyApp/
├── bin/
│ ├── MyApp.dll
│ ├── Pdfium.NET.dll
│ ├── x86/
│ │ └── pdfium.dll
│ └── x64/
│ └── pdfium.dll
├── runtimes/
│ ├── win-x86/native/
│ │ └── pdfium.dll
│ └── win-x64/native/
│ └── pdfium.dll
이후 (IronPDF) - 간결한 배포
MyApp/
├── bin/
│ ├── MyApp.dll
│ └── IronPdf.dll # 모든 것이 포함됨
네이티브 바이너리 참조 제거
# Delete native PDFium binaries
rm -rf x86/ x64/ runtimes/
# Remove from .csproj
# Delete any <Content Include="pdfium.dll" /> entries
# Delete any <None Include="x86/pdfium.dll" /> entries
# Delete native PDFium binaries
rm -rf x86/ x64/ runtimes/
# Remove from .csproj
# Delete any <Content Include="pdfium.dll" /> entries
# Delete any <None Include="x86/pdfium.dll" /> entries
중요한 마이그레이션 노트
스케일을 DPI 변환으로
Pdfium은 스케일 계수를 사용합니다; IronPDF는 DPI를 사용합니다:
// Formula:IronPDFDPI = 72 × Pdfium scale
// Pdfium scale 2.0 →IronPDFDPI 144
pdf.RasterizeToImageFiles("*.png", DPI: 144);
// Formula:IronPDFDPI = 72 × Pdfium scale
// Pdfium scale 2.0 →IronPDFDPI 144
pdf.RasterizeToImageFiles("*.png", DPI: 144);
' Formula: IronPDFDPI = 72 × Pdfium scale
' Pdfium scale 2.0 → IronPDFDPI 144
pdf.RasterizeToImageFiles("*.png", DPI:=144)
문서 로딩 방법 변경
// Pdfium
PdfDocument.Load(path)
// IronPDF
PdfDocument.FromFile(path)
// Pdfium
PdfDocument.Load(path)
// IronPDF
PdfDocument.FromFile(path)
저장 방법 변경
// Pdfium
document.Save(path)
// IronPDF
pdf.SaveAs(path)
// Pdfium
document.Save(path)
// IronPDF
pdf.SaveAs(path)
폐기 패턴 단순화
// Pdfium:필요함explicit disposal
using (var document = PdfDocument.Load(path))
using (var page = document.Pages[0])
using (var bitmap = page.Render(1024, 768))
{
bitmap.Save("output.png");
}
// IronPDF: Simplified
var pdf = PdfDocument.FromFile(path);
pdf.RasterizeToImageFiles("output.png");
// Pdfium:필요함explicit disposal
using (var document = PdfDocument.Load(path))
using (var page = document.Pages[0])
using (var bitmap = page.Render(1024, 768))
{
bitmap.Save("output.png");
}
// IronPDF: Simplified
var pdf = PdfDocument.FromFile(path);
pdf.RasterizeToImageFiles("output.png");
Imports PdfiumViewer
' Pdfium:필요함explicit disposal
Using document = PdfDocument.Load(path)
Using page = document.Pages(0)
Using bitmap = page.Render(1024, 768)
bitmap.Save("output.png")
End Using
End Using
End Using
' IronPDF: Simplified
Dim pdf = PdfDocument.FromFile(path)
pdf.RasterizeToImageFiles("output.png")
플랫폼별 코드 제거
// Pdfium:필요함platform detection
#if WIN64
// Load x64 pdfium.dll
#else
// Load x86 pdfium.dll
#endif
// IronPDF: Remove all platform-specific code
// Just use the API directly
// Pdfium:필요함platform detection
#if WIN64
// Load x64 pdfium.dll
#else
// Load x86 pdfium.dll
#endif
// IronPDF: Remove all platform-specific code
// Just use the API directly
#If WIN64 Then
' Load x64 pdfium.dll
#Else
' Load x86 pdfium.dll
#End If
' IronPDF: Remove all platform-specific code
' Just use the API directly
기능 비교 요약
| 기능 | Pdfium.NET | IronPDF |
|---|---|---|
| PDF 로드 | ✓ | ✓ |
| 이미지로 렌더링 | ✓ | ✓ |
| 텍스트 추출 | ✓(기본) | ✓(고급) |
| 페이지 정보 | ✓ | ✓ |
| HTML에서 생성 | ✗ | ✓ |
| URL에서 생성 | ✗ | ✓ |
| PDF 병합 | ✗ | ✓ |
| PDF 분할 | ✗ | ✓ |
| 워터마크 추가 | ✗ | ✓ |
| 헤더/푸터 | ✗ | ✓ |
| 폼 채우기 | ✗ | ✓ |
| 디지털 서명 | ✗ | ✓ |
| 비밀번호 보호 | ✗ | ✓ |
| 네이티브 종속성 | 필요함 | 없음 |
| 크로스 플랫폼 | 복잡함 | 자동 |
| 메모리 관리 | 수동 폐기 | 단순화됨 |
마이그레이션 체크리스트
사전 마이그레이션
- 코드베이스에서 모든 Pdfium 사용 식별
- 현재 렌더링 치수/스케일 문서화
- 프로젝트 내 네이티브 바이너리 위치 나열
- 플랫폼 전용 로딩 코드 확인
- PDF 생성 요구 사항 식별 (현재 별도 도구 사용 여부?)
- 변화를 위한 폐기 패턴 검토 -IronPDF라이센스 키를 받으세요
패키지 변경 사항
Pdfium.NET,Pdfium.Net.SDK,PdfiumViewerNuGet 패키지 제거- x86/, x64/, runtimes/ 폴더에서 네이티브 pdfium.dll 바이너리 삭제
- 플랫폼 전용 조건부 컴파일 제거
- .csproj 업데이트하여 네이티브 바이너리 참조 제거
IronPdfNuGet Install-Package:dotnet add package IronPdf
코드 변경 사항
- 시작 시 라이선스 키 구성 추가
PdfDocument.Load()를PdfDocument.FromFile()로 교체document.Save()를pdf.SaveAs()로 교체document.GetPdfText(i)반복문을pdf.ExtractAllText()로 교체- 스케일 계수를 DPI 값으로 변환 (DPI = 72 × 스케일)
- 폐기 패턴 단순화 (중첩된 using 구문 제거)
- 플랫폼 전용 코드 제거
마이그레이션 이후
- 렌더링 출력 품질 테스트
- 텍스트 추출 결과 비교
- 크로스 플랫폼 배포 테스트
- 새로운 기능 추가 (HTML에서 PDF로, 병합, 워터마크, 보안)
- 문서 업데이트

