푸터 콘텐츠로 바로가기
마이그레이션 가이드

C#에서 Pdfium에서 IronPDF로 마이그레이션하는 방법

PDFium .NET 래퍼에서 IronPDF로의 마이그레이션은 네이티브 바이너리 종속성이 있는 렌더링 중심 엔진에서 생성, 조작, 렌더링을 플랫폼별 복잡성 없이 처리하는 포괄적인 PDF 솔루션으로 .NET PDF 워크플로를 이동시킵니다. 이 가이드는 PDFium 자체에서 제공하지 않는 기능을 추가하면서 네이티브 종속성 관리를 제거하는 단계별 마이그레이션 경로를 제공합니다.

PDFium 래퍼에서 IronPDF로 마이그레이션해야 하는 이유

PDFium .NET 래퍼 이해하기

PDFium은 Chrome의 내장 PDF 뷰어에 사용되는 동일한 엔진인 Google's BSD-3-Clause C++ PDF 렌더링 및 파싱 엔진입니다. 공식 Google 제공 .NET 바인딩은 없습니다. 대신, .NET 생태계는 커뮤니티 래퍼를 통해 PDFium을 사용합니다. 네 가지 가장 일반적으로 인용되는 NuGet 패키지는 PdfiumViewer (pvginkel; Apache 2.0; 2019년 8월에 보관되었고, 마지막 릴리스는 2017년 11월에 2.13.0이었으며, .NET Framework 2.0+), PdfiumViewer.Updated (.NET Core / .NET 6으로 포팅된 유지 관리 포크), PDFiumCore (Dtronix; .NET Standard 2.1 P/Invoke 바인딩), 그리고 Pdfium.Net.SDK (Patagames; 상업적, 영구 라이선스 SDK)입니다.

그들의 API는 다르지만, PDFium 자체가 렌더링 및 파싱 엔진이라는 한 가지 특성을 공유합니다. PDFium에는 HTML 파서가 없고, 따라서 어느 래퍼도 독자적으로 HTML을 PDF로 변환할 수 없습니다. 이 가이드는 "before" 코드 조각에 대한 대표적인 래퍼로서 PdfiumViewer를 사용합니다. 해당 API가 가장 널리 인용되기 때문입니다; 마이그레이션 접근 방식은 네 가지 경우에 모두 동일합니다.

주요 PDFium 래퍼 제한사항

  1. 렌더링 우선: PDFium에는 HTML 파서가 없기 때문에 HTML, URL 또는 임의의 이미지에서 PDF를 생성할 수 없습니다.

  2. 오픈 소스 래퍼에서의 제한된 조작:PdfiumViewer/PDFiumCore는 보기 및 페이지별 텍스트 추출을 지원합니다; 병합 / 분할 / 폼 편집은 Patagames Pdfium.Net.SDK에서 부분적으로 가능하고, 무료 래퍼에서는 거의 없습니다.

  3. 네이티브 바이너리 종속성: 각 RID에 대해 플랫폼별 PDFium 바이너리 (pdfium.dll / .so / .dylib)가 필요합니다.

  4. 배포 복잡성: 각각의 플랫폼에 대해 x86, x64 및 런타임 폴더와 함께 네이티브 바이너리를 번들로 묶어 관리해야 합니다.

  5. 기본 텍스트 추출: PdfiumViewer는 GetPdfText(int)를 통해 각 페이지의 원본 텍스트를 제공합니다; 레이아웃 / 형식 메타데이터는 노출되지 않습니다.

  6. HTML을 PDF로 변환할 수 없음: PDFium에는 HTML 파서가 없으며; 웹 콘텐츠는 직접 변환할 수 없습니다.

  7. 기본 헤더/푸터 없음: 고급 페이지 오버레이 API가 없습니다.

  8. 기본 워터마크 없음: 스탬핑 원시가 없습니다.

  9. 양식: 무료 래퍼에는 읽기 전용이거나 없음; Patagames Pdfium.Net.SDK에서 사용 가능

  10. 보안: 무료 래퍼에서는 암호화/권한을 노출하지 않음; Patagames Pdfium.Net.SDK에서 사용 가능

PDFium 래퍼 vsIronPDF비교

측면 PDFium .NET 래퍼 IronPDF
주요 초점 렌더링/보기 완전한 PDF 솔루션
렌더링 충실도 고충실도 렌더링 고충실도, 특히 HTML/CSS/JS에서
HTML에서 PDF 생성 None 예 (HTML, URL, 이미지)
PDF 조작 무료 래퍼: 없음; Patagames: 부분적 예 (병합, 분할, 편집)
HTML to PDF None 예 (Chromium 엔진)
워터마크 내장되어 있지 않음
헤더/푸터 내장되어 있지 않음
양식 채우기 무료 래퍼: 없음; Patagames: 예
보안 무료 래퍼: 없음; Patagames: 예
네이티브 종속성 필요함 번들 / NuGet이 관리
크로스 플랫폼 수동 네이티브 바이너리 관리 자동
배포 용이성 네이티브 종속성으로 인해 복잡함 더 쉬움; 종속성 복잡성 감소

최신 .NET을 타겟으로 하는 팀에게 IronPDF는 포괄적인 PDF 생성 및 조작 기능을 추가하면서 네이티브 바이너리 관리를 제거하는 완전 관리 기본을 제공합니다.


시작하기 전에

필수 조건

  1. .NET 환경: .NET Framework 4.6.2+ 또는 .NET Core 3.1+ / .NET 5/6/7/8/9+
  2. NuGet 접근 권한: NuGet 패키지를 설치할 수 있는 능력
  3. IronPDF 라이선스: ironpdf.com에서 라이선스 키를 획득하세요

NuGet 패키지 변경 사항

# Remove whichever PDFium wrapper you used:
#  PdfiumViewer           (Apache 2.0 - archived 2019, .NET Framework only)
#   PdfiumViewer.Updated    (community fork, .NET Core / .NET 6)
#   PDFiumCore              (Dtronix - .NET Standard 2.1 P/Invoke bindings)
#   Pdfium.Net.SDK          (Patagames - commercial, perpetual license)
dotnet remove package PdfiumViewer
dotnet remove package PdfiumViewer.Updated
dotnet remove package PDFiumCore
dotnet remove package Pdfium.Net.SDK

# Install IronPDF
dotnet add package IronPdf
# Remove whichever PDFium wrapper you used:
#  PdfiumViewer           (Apache 2.0 - archived 2019, .NET Framework only)
#   PdfiumViewer.Updated    (community fork, .NET Core / .NET 6)
#   PDFiumCore              (Dtronix - .NET Standard 2.1 P/Invoke bindings)
#   Pdfium.Net.SDK          (Patagames - commercial, perpetual license)
dotnet remove package PdfiumViewer
dotnet remove package PdfiumViewer.Updated
dotnet remove package PDFiumCore
dotnet remove package Pdfium.Net.SDK

# Install IronPDF
dotnet add package IronPdf
SHELL

라이선스 구성

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

PDFium 래퍼 사용 식별

# Find PDFium wrapper usage
grep -rE "PdfiumViewer|PDFiumCore|Patagames\.Pdf|PdfDocument\.Load|\.Render\(" --include="*.cs" .

# Find native binary references
grep -rE "pdfium\.dll|libpdfium\.(so|dylib)" --include="*.csproj" --include="*.config" .

# Find platform-specific code
grep -rE "#if.*64|WIN32|WIN64|LINUX|OSX" --include="*.cs" .
# Find PDFium wrapper usage
grep -rE "PdfiumViewer|PDFiumCore|Patagames\.Pdf|PdfDocument\.Load|\.Render\(" --include="*.cs" .

# Find native binary references
grep -rE "pdfium\.dll|libpdfium\.(so|dylib)" --include="*.csproj" --include="*.config" .

# Find platform-specific code
grep -rE "#if.*64|WIN32|WIN64|LINUX|OSX" --include="*.cs" .
SHELL

완전한 API 참조

네임스페이스 변경

// PDFium wrappers (use the one you installed)
using PdfiumViewer;             //PdfiumViewer/PdfiumViewer.Updated
using PDFiumCore;               // Dtronix PDFiumCore (P/Invoke bindings)
using Patagames.Pdf;            // Patagames Pdfium.Net.SDK
using Patagames.Pdf.Net;        // Patagames Pdfium.Net.SDK

// IronPDF
using IronPdf;
using IronPdf.Rendering;
using IronPdf.Editing;
// PDFium wrappers (use the one you installed)
using PdfiumViewer;             //PdfiumViewer/PdfiumViewer.Updated
using PDFiumCore;               // Dtronix PDFiumCore (P/Invoke bindings)
using Patagames.Pdf;            // Patagames Pdfium.Net.SDK
using Patagames.Pdf.Net;        // Patagames Pdfium.Net.SDK

// IronPDF
using IronPdf;
using IronPdf.Rendering;
using IronPdf.Editing;
Imports PdfiumViewer 'PdfiumViewer/PdfiumViewer.Updated
Imports PDFiumCore ' Dtronix PDFiumCore (P/Invoke bindings)
Imports Patagames.Pdf ' Patagames Pdfium.Net.SDK
Imports Patagames.Pdf.Net ' Patagames Pdfium.Net.SDK

Imports IronPdf
Imports IronPdf.Rendering
Imports IronPdf.Editing
$vbLabelText   $csharpLabel

핵심 클래스 매핑

PdfiumViewer IronPDF 노트
PdfiumViewer.PdfDocument IronPdf.PdfDocument 다른 네임스페이스에서 같은 단순 이름
PdfRenderer (WinForms 컨트롤) (적용되지 않음) PdfiumViewer는 UI 제어도 제공합니다; IronPDF는 헤드리스
(사용 불가) ChromePdfRenderer HTML / URL → PDF
(사용 불가) HtmlHeaderFooter 헤더/푸터

문서 로딩 매핑

PdfiumViewer IronPDF 노트
PdfDocument.Load(path) PdfDocument.FromFile(path) 파일에서 로드
PdfDocument.Load(stream) PdfDocument.FromStream(stream) 스트림에서 로드
(MemoryStream에 바이트를 감쌈) PdfDocument.FromBinaryData(bytes) 바이트에서 로드

문서 속성 매핑

PdfiumViewer IronPDF 노트
document.PageCount document.PageCount 동일
document.PageSizes (IList<SizeF>) document.Pages[index].Width / Height PdfiumViewer는 크기를 노출합니다; pages are not first-class objects
document.PageSizes[i].Width document.Pages[i].Width 페이지별 너비(포인트로)

텍스트 추출 매핑

PdfiumViewer IronPDF 노트
document.GetPdfText(pageIndex) document.Pages[index].Text 페이지별
(수동 루프) document.ExtractAllText() 모든 페이지

문서 저장 매핑

PdfiumViewer IronPDF 노트
document.Save(stream) document.SaveAs(path) PdfiumViewer는 스트림을 사용합니다; IronPDF는 경로를 사용합니다
(사용 불가) document.Stream 원시 스트림 액세스
(사용 불가) document.BinaryData 바이트 가져오기

페이지 렌더링 매핑

PdfiumViewer IronPDF 노트
document.Render(page, width, height, dpiX, dpiY, flags) pdf.RasterizeToImageFiles(path, DPI) 래스터화
document.Render(i, ...)에 대해 수동 루프 pdf.RasterizeToImageFiles("page_*.png") 모든 페이지에 대한 배치 렌더링
수동 스케일 수학 DPI = 72 * scale DPI 변환에 맞춘 스케일

PDFium Wrappers에서 제공되지 않는 새로운 기능

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에서 텍스트 추출

이전 (PdfiumViewer):

// NuGet: Install-PackagePdfiumViewer (Apache 2.0;  archived Aug 2019, .NET Framework 2.0+)
//        or Install-Package PdfiumViewer.Updated  (maintained fork, .NET Core / .NET 6)
//        or Install-Package PDFiumCore             (Dtronix, .NET Standard 2.1 P/Invoke)
//        or Install-Package Pdfium.Net.SDK         (Patagames, commercial perpetual license)
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++)
            {
                // PdfiumViewer's text extraction is per-page raw text via GetPdfText(int).
                // No layout / format metadata is exposed.
                string pageText = document.GetPdfText(i);
                text.AppendLine(pageText);
            }

            Console.WriteLine(text.ToString());
        }
    }
}
// NuGet: Install-PackagePdfiumViewer (Apache 2.0;  archived Aug 2019, .NET Framework 2.0+)
//        or Install-Package PdfiumViewer.Updated  (maintained fork, .NET Core / .NET 6)
//        or Install-Package PDFiumCore             (Dtronix, .NET Standard 2.1 P/Invoke)
//        or Install-Package Pdfium.Net.SDK         (Patagames, commercial perpetual license)
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++)
            {
                // PdfiumViewer's text extraction is per-page raw text via GetPdfText(int).
                // No layout / format metadata is exposed.
                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
                ' PdfiumViewer's text extraction is per-page raw text via GetPdfText(int).
                ' No layout / format metadata is exposed.
                Dim pageText As String = document.GetPdfText(i)
                text.AppendLine(pageText)
            Next

            Console.WriteLine(text.ToString())
        End Using
    End Sub
End Module
$vbLabelText   $csharpLabel

이후 (IronPDF):

// NuGet: Install-Package IronPdf
using IronPdf;
using System;

class Program
{
    static void Main()
    {
        IronPdf.License.LicenseKey = "YOUR-LICENSE-KEY";

        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()
    {
        IronPdf.License.LicenseKey = "YOUR-LICENSE-KEY";

        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()
        IronPdf.License.LicenseKey = "YOUR-LICENSE-KEY"

        Dim pdfPath As String = "document.pdf"

        Dim pdf = PdfDocument.FromFile(pdfPath)
        Dim text As String = pdf.ExtractAllText()

        Console.WriteLine(text)
    End Sub
End Class
$vbLabelText   $csharpLabel

여기서의 차이는 매우 큽니다. PdfiumViewer는 각 페이지를 대상으로 한 GetPdfText(int)를 통해 수동 루프가 필요하며, StringBuilder를 작성하고 올바른 처리를 위해 using 문을 관리합니다. 반환된 텍스트는 레이아웃/형식 메타데이터가 없는 원본 페이지 텍스트입니다.

IronPDF는 이를 몇 줄로 간단하게 만듭니다: PdfDocument.FromFile()로 로드하고, ExtractAllText()로 추출한 후 출력합니다. ExtractAllText() 메소드는 모든 페이지를 자동으로 처리합니다. 페이지별 추출이 필요한 경우 pdf.Pages[index].Text를 사용할 수 있습니다. 텍스트 추출 문서에서 추가 옵션을 참조하세요.

예제 2: PDF 병합

이전 (PdfiumViewer):

// NuGet: Install-PackagePdfiumViewer (representative open-source PDFium wrapper)
//PdfiumViewerand PDFiumCore do not expose PDF merge APIs - PDFium itself
// is a rendering / parsing engine, not a document-authoring engine.
// (Patagames Pdfium.Net.SDK exposes some document-edit operations but is commercial.)
using PdfiumViewer;
using System;
using System.IO;
using System.Collections.Generic;

class Program
{
    static void Main()
    {
        List<string> pdfFiles = new List<string>
        {
            "document1.pdf",
            "document2.pdf",
            "document3.pdf"
        };

        // To merge PDFs from a PDFium wrapper you must reach for another library
        // (PdfSharp, iText, IronPDF) or, with Patagames Pdfium.Net.SDK, use its
        // document-edit APIs.

        Console.WriteLine("PDF merging is not supported byPdfiumViewer/PDFiumCore.");
    }
}
// NuGet: Install-PackagePdfiumViewer (representative open-source PDFium wrapper)
//PdfiumViewerand PDFiumCore do not expose PDF merge APIs - PDFium itself
// is a rendering / parsing engine, not a document-authoring engine.
// (Patagames Pdfium.Net.SDK exposes some document-edit operations but is commercial.)
using PdfiumViewer;
using System;
using System.IO;
using System.Collections.Generic;

class Program
{
    static void Main()
    {
        List<string> pdfFiles = new List<string>
        {
            "document1.pdf",
            "document2.pdf",
            "document3.pdf"
        };

        // To merge PDFs from a PDFium wrapper you must reach for another library
        // (PdfSharp, iText, IronPDF) or, with Patagames Pdfium.Net.SDK, use its
        // document-edit APIs.

        Console.WriteLine("PDF merging is not supported byPdfiumViewer/PDFiumCore.");
    }
}
Imports PdfiumViewer
Imports System
Imports System.IO
Imports System.Collections.Generic

Module Program
    Sub Main()
        Dim pdfFiles As New List(Of String) From {
            "document1.pdf",
            "document2.pdf",
            "document3.pdf"
        }

        ' To merge PDFs from a PDFium wrapper you must reach for another library
        ' (PdfSharp, iText, IronPDF) or, with Patagames Pdfium.Net.SDK, use its
        ' document-edit APIs.

        Console.WriteLine("PDF merging is not supported by PdfiumViewer/PDFiumCore.")
    End Sub
End Module
$vbLabelText   $csharpLabel

이후 (IronPDF):

// NuGet: Install-Package IronPdf
using IronPdf;
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static void Main()
    {
        IronPdf.License.LicenseKey = "YOUR-LICENSE-KEY";

        List<string> pdfFiles = new List<string>
        {
            "document1.pdf",
            "document2.pdf",
            "document3.pdf"
        };

        // PdfDocument.Merge accepts an IEnumerable<PdfDocument>, so load each file first.
        var docs = pdfFiles.Select(path => PdfDocument.FromFile(path)).ToList();
        var merged = PdfDocument.Merge(docs);
        merged.SaveAs("merged.pdf");

        Console.WriteLine("PDFs merged successfully");
    }
}
// NuGet: Install-Package IronPdf
using IronPdf;
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static void Main()
    {
        IronPdf.License.LicenseKey = "YOUR-LICENSE-KEY";

        List<string> pdfFiles = new List<string>
        {
            "document1.pdf",
            "document2.pdf",
            "document3.pdf"
        };

        // PdfDocument.Merge accepts an IEnumerable<PdfDocument>, so load each file first.
        var docs = pdfFiles.Select(path => PdfDocument.FromFile(path)).ToList();
        var merged = PdfDocument.Merge(docs);
        merged.SaveAs("merged.pdf");

        Console.WriteLine("PDFs merged successfully");
    }
}
Imports IronPdf
Imports System
Imports System.Collections.Generic
Imports System.Linq

Module Program
    Sub Main()
        IronPdf.License.LicenseKey = "YOUR-LICENSE-KEY"

        Dim pdfFiles As New List(Of String) From {
            "document1.pdf",
            "document2.pdf",
            "document3.pdf"
        }

        ' PdfDocument.Merge accepts an IEnumerable(Of PdfDocument), so load each file first.
        Dim docs = pdfFiles.Select(Function(path) PdfDocument.FromFile(path)).ToList()
        Dim merged = PdfDocument.Merge(docs)
        merged.SaveAs("merged.pdf")

        Console.WriteLine("PDFs merged successfully")
    End Sub
End Module
$vbLabelText   $csharpLabel

이 예제는 기능 격차를 강조합니다. 무료 PDFium 래퍼(PdfiumViewer, PDFiumCore)는 병합 API를 노출하지 않습니다; Patagames Pdfium.Net.SDK는 일부 문서 편집 작업을 노출하지만 상업적 제품입니다.

IronPDF는 정적 PdfDocument.Merge() 메소드를 통해 네이티브 병합을 제공하며, 이는 IEnumerable<PdfDocument>를 필요로 합니다. 각 입력 파일을 PdfDocument.FromFile()로 먼저 로드한 다음 결과 문서를 병합하면 됩니다. 결과는 SaveAs()로 저장하는 새로운 PdfDocument입니다. PDF 병합 및 분할에 대해 더 알아보세요.

예제 3: HTML에서 PDF로 변환

이전 (PdfiumViewer):

// NuGet: Install-PackagePdfiumViewer (representative PDFium wrapper)
// PDFium is a PDF rendering / parsing engine. It has NO HTML parser, so no
// PDFium .NET wrapper (PdfiumViewer, PdfiumViewer.Updated, PDFiumCore,
// Pdfium.Net.SDK) can convert HTML to PDF on its own.
using PdfiumViewer;
using System;
using System.IO;
using System.Drawing.Printing;

class Program
{
    static void Main()
    {
        // PDFium has no native HTML-to-PDF capability.
        // Produce the PDF with another engine (wkhtmltopdf, headless Chromium,
        // IronPDF, etc.) and then load it with PdfDocument.Load(...) for rendering.
        string htmlContent = "<h1>Hello World</h1>";

        Console.WriteLine("HTML to PDF conversion is not supported by PDFium.");
    }
}
// NuGet: Install-PackagePdfiumViewer (representative PDFium wrapper)
// PDFium is a PDF rendering / parsing engine. It has NO HTML parser, so no
// PDFium .NET wrapper (PdfiumViewer, PdfiumViewer.Updated, PDFiumCore,
// Pdfium.Net.SDK) can convert HTML to PDF on its own.
using PdfiumViewer;
using System;
using System.IO;
using System.Drawing.Printing;

class Program
{
    static void Main()
    {
        // PDFium has no native HTML-to-PDF capability.
        // Produce the PDF with another engine (wkhtmltopdf, headless Chromium,
        // IronPDF, etc.) and then load it with PdfDocument.Load(...) for rendering.
        string htmlContent = "<h1>Hello World</h1>";

        Console.WriteLine("HTML to PDF conversion is not supported by PDFium.");
    }
}
Imports PdfiumViewer
Imports System
Imports System.IO
Imports System.Drawing.Printing

Module Program
    Sub Main()
        ' PDFium has no native HTML-to-PDF capability.
        ' Produce the PDF with another engine (wkhtmltopdf, headless Chromium,
        ' IronPDF, etc.) and then load it with PdfDocument.Load(...) for rendering.
        Dim htmlContent As String = "<h1>Hello World</h1>"

        Console.WriteLine("HTML to PDF conversion is not supported by PDFium.")
    End Sub
End Module
$vbLabelText   $csharpLabel

이후 (IronPDF):

// NuGet: Install-Package IronPdf
using IronPdf;
using System;

class Program
{
    static void Main()
    {
        IronPdf.License.LicenseKey = "YOUR-LICENSE-KEY";

        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()
    {
        IronPdf.License.LicenseKey = "YOUR-LICENSE-KEY";

        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

Module Program
    Sub Main()
        IronPdf.License.LicenseKey = "YOUR-LICENSE-KEY"

        Dim renderer As 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 Module
$vbLabelText   $csharpLabel

이 예제는 가장 중요한 기능 차이를 보여줍니다. PDFium에는 HTML 파서가 없기 때문에, 이를 둘러싼 .NET 래퍼는 자체적으로 HTML을 PDF로 변환할 수 없습니다.

IronPDF는 ChromePdfRenderer를 통해 네이티브 HTML을 PDF로 변환하며, 이는 HTML, CSS 및 JavaScript의 정확한 렌더링을 위해 내부적으로 Chromium 엔진을 사용합니다. RenderHtmlAsPdf() 메소드는 HTML 문자열을 직접 PDF 문서로 변환합니다. IronPDF는 또한 RenderUrlAsPdf()를 통해 URL을 렌더링할 수 있으며, RenderHtmlFileAsPdf()로 HTML 파일을 렌더링할 수 있습니다. HTML에서 PDF로의 문서에서 포괄적인 예제를 참조하세요.


네이티브 종속성 제거

PDFium 래퍼에서 IronPDF로 마이그레이션의 가장 큰 이점 중 하나는 네이티브 바이너리 관리의 제거입니다.

Before (PDFium wrapper) - 복잡한 배포

MyApp/
├── bin/
│   ├── MyApp.dll
│   ├── PdfiumViewer.dll      # or PDFiumCore.dll / Patagames.Pdf.dll
│   ├── x86/
│   │   └── pdfium.dll
│   └── x64/
│       └── pdfium.dll
├── runtimes/
│   ├── win-x86/native/
│   │   └── pdfium.dll
│   ├── win-x64/native/
│   │   └── pdfium.dll
│   ├── linux-x64/native/
│   │   └── libpdfium.so
│   └── osx-x64/native/
│       └── libpdfium.dylib

이후 (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
SHELL

중요한 마이그레이션 노트

스케일을 DPI 변환으로

PdfiumViewer의 Render(...)는 명시적인 dpiX/dpiY를 필요로 하며 PDFium의 기본 렌더링은 스케일 기반입니다 (1.0 = 72 DPI). IronPDF는 DPI를 직접 사용합니다:

// Formula:IronPDF DPI = 72 × PDFium scale
// PDFium scale 2.0 →IronPDF DPI 144
pdf.RasterizeToImageFiles("*.png", DPI: 144);
// Formula:IronPDF DPI = 72 × PDFium scale
// PDFium scale 2.0 →IronPDF DPI 144
pdf.RasterizeToImageFiles("*.png", DPI: 144);
' Formula: IronPDF DPI = 72 × PDFium scale
' PDFium scale 2.0 → IronPDF DPI 144
pdf.RasterizeToImageFiles("*.png", DPI:=144)
$vbLabelText   $csharpLabel

문서 로딩 방법 변경

// PdfiumViewer
PdfDocument.Load(path)

// IronPDF
PdfDocument.FromFile(path)
// PdfiumViewer
PdfDocument.Load(path)

// IronPDF
PdfDocument.FromFile(path)
' PdfiumViewer
PdfDocument.Load(path)

' IronPDF
PdfDocument.FromFile(path)
$vbLabelText   $csharpLabel

저장 방법 변경

//PdfiumViewer(takes a Stream)
document.Save(stream)

//IronPDF(takes a path)
pdf.SaveAs(path)
//PdfiumViewer(takes a Stream)
document.Save(stream)

//IronPDF(takes a path)
pdf.SaveAs(path)
' PdfiumViewer (takes a Stream)
document.Save(stream)

' IronPDF (takes a path)
pdf.SaveAs(path)
$vbLabelText   $csharpLabel

폐기 패턴 단순화

// PdfiumViewer: explicit disposal of document and the rendered Image
using (var document = PdfDocument.Load(path))
using (var bitmap = document.Render(0, 1024, 768, 96, 96, PdfRenderFlags.None))
{
    bitmap.Save("output.png");
}

// IronPDF: Simplified
var pdf = PdfDocument.FromFile(path);
pdf.RasterizeToImageFiles("output.png");
// PdfiumViewer: explicit disposal of document and the rendered Image
using (var document = PdfDocument.Load(path))
using (var bitmap = document.Render(0, 1024, 768, 96, 96, PdfRenderFlags.None))
{
    bitmap.Save("output.png");
}

// IronPDF: Simplified
var pdf = PdfDocument.FromFile(path);
pdf.RasterizeToImageFiles("output.png");
Imports PdfiumViewer

' PdfiumViewer: explicit disposal of document and the rendered Image
Using document = PdfDocument.Load(path)
    Using bitmap = document.Render(0, 1024, 768, 96, 96, PdfRenderFlags.None)
        bitmap.Save("output.png")
    End Using
End Using

' IronPDF: Simplified
Dim pdf = PdfDocument.FromFile(path)
pdf.RasterizeToImageFiles("output.png")
$vbLabelText   $csharpLabel

플랫폼별 코드 제거

// PDFium wrapper: required platform detection / RID-specific binaries
#if WIN64
    // Load x64 pdfium.dll
#else
    // Load x86 pdfium.dll
#endif

// IronPDF: Remove all platform-specific code
// Just use the API directly
// PDFium wrapper: required platform detection / RID-specific binaries
#if WIN64
    // Load x64 pdfium.dll
#else
    // Load x86 pdfium.dll
#endif

// IronPDF: Remove all platform-specific code
// Just use the API directly
$vbLabelText   $csharpLabel

기능 비교 요약

기능 PDFium .NET 래퍼 IronPDF
PDF 로드
이미지로 렌더링
텍스트 추출 예 (기본, 페이지별) 예 (논리적 / 시각적 순서)
페이지 정보
HTML에서 생성 None
URL에서 생성 None
PDF 병합 무료 래퍼: 아니요; Patagames: 부분적
PDF 분할 무료 래퍼: 아니요; Patagames: 부분적
워터마크 추가 내장되어 있지 않음
헤더/푸터 내장되어 있지 않음
폼 채우기 무료 래퍼: 아니요; Patagames: 예
디지털 서명 무료 래퍼: 아니요; Patagames: 예
비밀번호 보호 무료 래퍼: 아니요; Patagames: 예
네이티브 종속성 필요함 번들 / NuGet이 관리
크로스 플랫폼 복잡한 (per-RID 네이티브 바이너리) 자동
메모리 관리 수동 폐기 단순화됨

마이그레이션 체크리스트

사전 마이그레이션

  • 어떤 PDFium 래퍼가 사용되고 있는지 식별합니다 (PdfiumViewer / PdfiumViewer.Updated / PDFiumCore / Pdfium.Net.SDK)
  • 현재 렌더링 차원 / DPI / 사용된 스케일을 문서화합니다
  • 프로젝트에서 네이티브 바이너리 위치를 나열합니다 (RID별)
  • 플랫폼 전용 로딩 코드 확인
  • PDF 생성 요구 사항 식별 (현재 별도 도구 사용 여부?)
  • 변화를 위한 폐기 패턴 검토 -IronPDF라이센스 키를 받으세요

패키지 변경 사항

  • PDFium 래퍼 NuGet 패키지(들)를 제거하세요: PdfiumViewer, PdfiumViewer.Updated, PDFiumCore, 또는 Pdfium.Net.SDK
  • x86/, x64/, runtimes/ 폴더에서 네이티브 pdfium.dll / .so / .dylib 바이너리를 삭제하세요
  • 플랫폼 전용 조건부 컴파일 제거
  • .csproj 업데이트하여 네이티브 바이너리 참조 제거
  • IronPdf NuGet 패키지를 설치하세요: dotnet add package IronPdf

코드 변경 사항

  • 시작 시 라이선스 키 구성 추가
  • PdfDocument.Load()PdfDocument.FromFile()로 교체하세요
  • document.Save()pdf.SaveAs()로 교체하세요
  • document.GetPdfText(i) 루프를 pdf.ExtractAllText()로 교체하세요
  • 스케일 계수를 DPI 값으로 변환 (DPI = 72 × 스케일)
  • 폐기 패턴 단순화 (중첩된 using 구문 제거)
  • 플랫폼 전용 코드 제거

마이그레이션 이후

  • 렌더링 출력 품질 테스트
  • 텍스트 추출 결과 비교
  • 크로스 플랫폼 배포 테스트
  • 새로운 기능 추가 (HTML에서 PDF로, 병합, 워터마크, 보안)
  • 문서 업데이트

참고해 주세요Google LLC의 프로젝트인 PDFium은 BSD-3-Clause에 따라 출시되었습니다. PdfiumViewer, PDFiumCore, 그리고 Pdfium.Net.SDK는 해당 소유자 (pvginkel, Dtronix, 및 Patagames Software Ltd)의 상표입니다. 이 사이트는 Google, Chromium Project, 또는 어떤 래퍼 작성자와도 관련이 없으며, 승인을 받거나 후원을 받지 않았습니다. 모든 제품명, 로고 및 브랜드는 해당 소유자의 자산입니다. 비교는 정보 제공 목적으로만 사용되며, 작성 시점에 공개적으로 이용 가능한 정보를 반영합니다.

Curtis Chau
기술 문서 작성자

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

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

아이언 서포트 팀

저희는 주 5일, 24시간 온라인으로 운영합니다.
채팅
이메일
전화해