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

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

GemBox.Pdf에서 IronPDF로의 마이그레이션은 .NET PDF 워크플로우를 좌표 기반의 프로그래매틱한 문서 구성에서 현대적인 HTML/CSS 기반 렌더링으로 변경합니다. 이 가이드는 전문 .NET 개발자를 위한 2페이지 무료 모드의 상한선을 제거하고 문서 생성을 단순화하는 포괄적이고 단계별 마이그레이션 경로를 제공합니다.

GemBox.Pdf에서 IronPDF로의 마이그레이션 이유

GemBox.Pdf의 도전 과제

GemBox.Pdf는 유능한 .NET PDF 구성 요소이지만 실제 개발을 위해 고심할 가치가 있는 몇 가지 제한이 있습니다:

  1. 2페이지 무료 모드 제한: 무료 버전은 2페이지를 초과하는 PDF를 로드하거나 저장할 때 FreeLimitReachedException를 발생시킵니다. 따라서 한 페이지의 영수증이나 두 페이지의 청구서를 초과하는 경우 유료 라이선스가 필요합니다. (Source: gemboxsoftware.com/pdf/free-version.)

  2. HTML-to-PDF 변환 불가: GemBox.Pdf는 HTML을 렌더링할 수 없습니다 — PdfDocument.Load는 기존 PDF 파일만 엽니다. HTML을 PDF로 변환하려면 별도의 GemBox.Document 제품(다른 SKU, 다른 라이선스)을 구매해야 합니다.

  3. 좌표 기반 레이아웃: GemBox.Pdf는 낮은 수준의 PDF 콘텐츠 스트림 API입니다. PDF 사용자 공간 단위로 X/Y를 계산하고 page.Content.DrawText(formattedText, new PdfPoint(x, y))을 호출하여 텍스트를 배치합니다. 흐름 레이아웃이 없습니다.

  4. 오피스에서 PDF로는 다른 SKU가 필요: Word→PDF는 GemBox.Document가 필요하고, Excel→PDF는 GemBox.Spreadsheet가 필요하며, 각각 별도로 라이선스됩니다; GemBox.Bundle은 이를 모두 포함하지만 더 비쌉니다.

  5. 프로그램 방식만 지원: 모든 디자인 변경은 코드 변경이 필요합니다. 간격을 조정하시겠습니까? 좌표를 재계산하세요. 폰트 크기를 변경하시겠습니까? 그 아래의 Y 위치를 조정하세요.

  6. 상업용-라이선스 가격: 단일 개발자 라이선스는 $890입니다 (갱신은 $534), 소규모 팀(10 개발자)은 $4,450, 대규모 팀(50 개발자)은 $13,350입니다. (출처: gemboxsoftware.com/pdf/pricing.)

  7. 디자인을 위한 학습 곡선: 개발자는 문서 흐름 대신 좌표로 생각해야 하므로 '단락 추가'와 같은 간단한 작업도 놀라울 만큼 복잡합니다.

GemBox.Pdf와IronPDF비교

측면 GemBox.Pdf IronPDF
무료 버전 제한 2페이지 최대 (FreeLimitReachedException) 워터마크만, 페이지 상한 없음
HTML-to-PDF 지원되지 않음 (GemBox.Document 필요) 전체 Chromium 엔진
Word/Excel → PDF 별도의 SKU들 (GemBox.Document / GemBox.Spreadsheet) HTML 파이프라인을 통해 렌더링
레이아웃 접근 방식 좌표 기반, 수동 HTML/CSS 흐름 레이아웃
최신 CSS 적용 안 됨 Flexbox, 그리드, CSS3 애니메이션
JavaScript 지원 적용 안 됨 완전한 JavaScript 실행
디자인 변경 좌표 재계산 HTML/CSS 편집
학습 곡선 PDF 좌표 시스템 HTML/CSS (웹 익숙함)

IronPDF는 현대 .NET에서 PDF 생성을 위해 익숙한 웹 기술을 활용합니다.


마이그레이션 복잡성 평가

기능별 예상 노력

기능 마이그레이션 복잡성
로딩/저장 PDF 매우 낮음
PDF 병합 매우 낮음
PDF 분할 낮음
텍스트 추출 매우 낮음
텍스트 추가 중간
낮음
이미지 낮음
워터마크 낮음
비밀번호 보호 중간
양식 필드 중간

패러다임 전환

이 GemBox.Pdf 마이그레이션의 가장 큰 변화는 좌표 기반 레이아웃에서 HTML/CSS 레이아웃으로의 이동입니다:

GemBox.Pdf:  "(100, 700) 위치에 텍스트 그리기"
IronPDF:     "이 HTML을 CSS 스타일링으로 렌더링"

이 패러다임 전환은 웹 기술에 익숙한 개발자에게 일반적으로 더 쉬우나, PDF를 다르게 생각할 필요가 있습니다.


시작하기 전에

필수 조건

  1. .NET 버전: IronPDF는 .NET Framework 4.6.2+ 및 .NET Core 2.0+/ .NET 5+를 지원합니다.
  2. 라이선스 키: ironpdf.com에서IronPDF라이선스 키를 얻으세요.
  3. 백업: 마이그레이션 작업을 위한 분기를 생성하세요.
  4. HTML/CSS 지식: 기본적인 친숙함은 도움이 되지만 필수는 아님

모든 GemBox.Pdf 사용 확인

# Find all GemBox.Pdf references
grep -r "GemBox\.Pdf\|PdfDocument\|PdfPage\|PdfFormattedText\|ComponentInfo\.SetLicense" --include="*.cs" .

# Find package references
grep -r "GemBox\.Pdf" --include="*.csproj" .
# Find all GemBox.Pdf references
grep -r "GemBox\.Pdf\|PdfDocument\|PdfPage\|PdfFormattedText\|ComponentInfo\.SetLicense" --include="*.cs" .

# Find package references
grep -r "GemBox\.Pdf" --include="*.csproj" .
SHELL

NuGet 패키지 변경 사항

# Remove GemBox.Pdf
dotnet remove package GemBox.Pdf

# Install IronPDF
dotnet add package IronPdf
# Remove GemBox.Pdf
dotnet remove package GemBox.Pdf

# Install IronPDF
dotnet add package IronPdf
SHELL

빠른 시작 마이그레이션

1단계: 라이선스 구성 업데이트

이전 (GemBox.Pdf):

// Must call before any GemBox.Pdf operations
ComponentInfo.SetLicense("FREE-LIMITED-KEY");
// Or for professional:
ComponentInfo.SetLicense("YOUR-PROFESSIONAL-LICENSE");
// Must call before any GemBox.Pdf operations
ComponentInfo.SetLicense("FREE-LIMITED-KEY");
// Or for professional:
ComponentInfo.SetLicense("YOUR-PROFESSIONAL-LICENSE");
' Must call before any GemBox.Pdf operations
ComponentInfo.SetLicense("FREE-LIMITED-KEY")
' Or for professional:
ComponentInfo.SetLicense("YOUR-PROFESSIONAL-LICENSE")
$vbLabelText   $csharpLabel

이후 (IronPDF):

// Set once at application startup
IronPdf.License.LicenseKey = "YOUR-LICENSE-KEY";

// Or in appsettings.json:
// { "IronPdf.License.LicenseKey": "YOUR-LICENSE-KEY" }
// Set once at application startup
IronPdf.License.LicenseKey = "YOUR-LICENSE-KEY";

// Or in appsettings.json:
// { "IronPdf.License.LicenseKey": "YOUR-LICENSE-KEY" }
Imports IronPdf

' Set once at application startup
IronPdf.License.LicenseKey = "YOUR-LICENSE-KEY"

' Or in appsettings.json:
' { "IronPdf.License.LicenseKey": "YOUR-LICENSE-KEY" }
$vbLabelText   $csharpLabel

2단계: 네임스페이스 가져오기 업데이트

// Before (GemBox.Pdf)
using GemBox.Pdf;
using GemBox.Pdf.Content;

// After (IronPDF)
using IronPdf;
using IronPdf.Editing;
// Before (GemBox.Pdf)
using GemBox.Pdf;
using GemBox.Pdf.Content;

// After (IronPDF)
using IronPdf;
using IronPdf.Editing;
Imports IronPdf
Imports IronPdf.Editing
$vbLabelText   $csharpLabel

3단계: 기본 변환 패턴

이전 (GemBox.Pdf):

using GemBox.Pdf;
using GemBox.Pdf.Content;

ComponentInfo.SetLicense("FREE-LIMITED-KEY");

using (var document = new PdfDocument())
{
    var page = document.Pages.Add();
    // PdfFormattedText has no Text property; use Append/AppendLine.
    var formattedText = new PdfFormattedText();
    formattedText.FontSize = 24;
    formattedText.Append("Hello World");

    page.Content.DrawText(formattedText, new PdfPoint(100, 700));
    document.Save("output.pdf");
}
using GemBox.Pdf;
using GemBox.Pdf.Content;

ComponentInfo.SetLicense("FREE-LIMITED-KEY");

using (var document = new PdfDocument())
{
    var page = document.Pages.Add();
    // PdfFormattedText has no Text property; use Append/AppendLine.
    var formattedText = new PdfFormattedText();
    formattedText.FontSize = 24;
    formattedText.Append("Hello World");

    page.Content.DrawText(formattedText, new PdfPoint(100, 700));
    document.Save("output.pdf");
}
Imports GemBox.Pdf
Imports GemBox.Pdf.Content

ComponentInfo.SetLicense("FREE-LIMITED-KEY")

Using document As New PdfDocument()
    Dim page = document.Pages.Add()
    ' PdfFormattedText has no Text property; use Append/AppendLine.
    Dim formattedText As New PdfFormattedText()
    formattedText.FontSize = 24
    formattedText.Append("Hello World")

    page.Content.DrawText(formattedText, New PdfPoint(100, 700))
    document.Save("output.pdf")
End Using
$vbLabelText   $csharpLabel

이후 (IronPDF):

using IronPdf;

IronPdf.License.LicenseKey = "YOUR-LICENSE-KEY";

var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderHtmlAsPdf("<h1 style='font-size:24px;'>Hello World</h1>");
pdf.SaveAs("output.pdf");
using IronPdf;

IronPdf.License.LicenseKey = "YOUR-LICENSE-KEY";

var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderHtmlAsPdf("<h1 style='font-size:24px;'>Hello World</h1>");
pdf.SaveAs("output.pdf");
Imports IronPdf

IronPdf.License.LicenseKey = "YOUR-LICENSE-KEY"

Dim renderer As New ChromePdfRenderer()
Dim pdf = renderer.RenderHtmlAsPdf("<h1 style='font-size:24px;'>Hello World</h1>")
pdf.SaveAs("output.pdf")
$vbLabelText   $csharpLabel

주요 차이점:

  • 좌표 계산 필요 없음
  • 프로그램 레이아웃 대신 HTML/CSS 사용
  • 2페이지 무료 모드 상한 없음
  • 더 간단하고 읽기 쉬운 코드

완전한 API 참조

네임스페이스 매핑

GemBox.Pdf IronPDF
GemBox.Pdf IronPdf
GemBox.Pdf.Content IronPdf (내용은 HTML임)
GemBox.Pdf.Security IronPdf (SecuritySettings)
GemBox.Pdf.Forms IronPdf.Forms

핵심 클래스 매핑

GemBox.Pdf IronPDF 설명
PdfDocument PdfDocument 주요 PDF 문서 클래스
PdfPage PdfDocument.Pages[i] 페이지 표현
PdfContent 해당 없음 (HTML 사용) 페이지 내용
PdfFormattedText 해당 없음 (HTML 사용) 서식 있는 텍스트
PdfPoint 해당 없음 (CSS 위치 사용) 좌표 위치
ComponentInfo.SetLicense() IronPdf.License.LicenseKey 라이선스 관리

문서 작업

GemBox.Pdf IronPDF
new PdfDocument() new PdfDocument()
PdfDocument.Load(path) PdfDocument.FromFile(path)
PdfDocument.Load(stream) PdfDocument.FromStream(stream)
document.Save(path) pdf.SaveAs(path)
document.Save(stream) pdf.BinaryData (반환값은 byte[])

페이지 작업

GemBox.Pdf IronPDF
document.Pages.Add() HTML 렌더링을 통해 생성
document.Pages.Count pdf.PageCount
document.Pages[index] pdf.Pages[index]
document.Pages.AddClone(pages) PdfDocument.Merge()

텍스트 및 콘텐츠 작업

GemBox.Pdf IronPDF
new PdfFormattedText() HTML 문자열
formattedText.Append(text) HTML에 포함
formattedText.AppendLine(text) HTML에 포함
formattedText.FontSize = 12 CSS font-size: 12pt
formattedText.Font = ... CSS font-family: ...
page.Content.DrawText(text, point) renderer.RenderHtmlAsPdf(html)
page.Content.GetText() pdf.ExtractTextFromPage(i)

코드 마이그레이션 예제

예제 1: HTML에서 PDF로 변환

Before (GemBox.Pdf) — GemBox.Pdf에서 지원되지 않음; 별도의 GemBox.Document SKU가 필요합니다:

// NuGet: Install-Package GemBox.Document
// NOTE: GemBox.Pdf does NOT support HTML-to-PDF. PdfDocument.Load only opens
// existing PDF files. To convert HTML to PDF you must use the separate
// GemBox.Document product (different SKU, different license).
using GemBox.Document;

class Program
{
    static void Main()
    {
        ComponentInfo.SetLicense("FREE-LIMITED-KEY");

        // GemBox.Document loads HTML and saves as PDF.
        var document = DocumentModel.Load("input.html");
        document.Save("output.pdf");
    }
}
// NuGet: Install-Package GemBox.Document
// NOTE: GemBox.Pdf does NOT support HTML-to-PDF. PdfDocument.Load only opens
// existing PDF files. To convert HTML to PDF you must use the separate
// GemBox.Document product (different SKU, different license).
using GemBox.Document;

class Program
{
    static void Main()
    {
        ComponentInfo.SetLicense("FREE-LIMITED-KEY");

        // GemBox.Document loads HTML and saves as PDF.
        var document = DocumentModel.Load("input.html");
        document.Save("output.pdf");
    }
}
Imports GemBox.Document

Module Program

    Sub Main()
        ComponentInfo.SetLicense("FREE-LIMITED-KEY")

        ' GemBox.Document loads HTML and saves as PDF.
        Dim document = DocumentModel.Load("input.html")
        document.Save("output.pdf")
    End Sub

End Module
$vbLabelText   $csharpLabel

이후 (IronPDF):

// NuGet: Install-Package IronPdf
using IronPdf;

class Program
{
    static void Main()
    {
        var renderer = new ChromePdfRenderer();
        var pdf = renderer.RenderHtmlAsPdf("<h1>Hello World</h1>");
        pdf.SaveAs("output.pdf");
    }
}
// NuGet: Install-Package IronPdf
using IronPdf;

class Program
{
    static void Main()
    {
        var renderer = new ChromePdfRenderer();
        var pdf = renderer.RenderHtmlAsPdf("<h1>Hello World</h1>");
        pdf.SaveAs("output.pdf");
    }
}
Imports IronPdf

Class Program
    Shared Sub Main()
        Dim renderer = New ChromePdfRenderer()
        Dim pdf = renderer.RenderHtmlAsPdf("<h1>Hello World</h1>")
        pdf.SaveAs("output.pdf")
    End Sub
End Class
$vbLabelText   $csharpLabel

IronPDF의 ChromePdfRenderer는 최신 Chromium 엔진을 사용하여 HTML/CSS/JavaScript를 렌더링합니다. 따라서 단일 NuGet 패키지가 HTML-to-PDF를 직접 지원하며 별도의 SKU가 필요하지 않습니다. HTML to PDF 문서를 통해 더 많은 렌더링 옵션을 확인하십시오.

예제 2: PDF 파일 병합

이전 (GemBox.Pdf):

// NuGet: Install-Package GemBox.Pdf
using GemBox.Pdf;
using System.Linq;

class Program
{
    static void Main()
    {
        ComponentInfo.SetLicense("FREE-LIMITED-KEY");

        using (var document = new PdfDocument())
        {
            var source1 = PdfDocument.Load("document1.pdf");
            var source2 = PdfDocument.Load("document2.pdf");

            document.Pages.AddClone(source1.Pages);
            document.Pages.AddClone(source2.Pages);

            document.Save("merged.pdf");
        }
    }
}
// NuGet: Install-Package GemBox.Pdf
using GemBox.Pdf;
using System.Linq;

class Program
{
    static void Main()
    {
        ComponentInfo.SetLicense("FREE-LIMITED-KEY");

        using (var document = new PdfDocument())
        {
            var source1 = PdfDocument.Load("document1.pdf");
            var source2 = PdfDocument.Load("document2.pdf");

            document.Pages.AddClone(source1.Pages);
            document.Pages.AddClone(source2.Pages);

            document.Save("merged.pdf");
        }
    }
}
Imports GemBox.Pdf
Imports System.Linq

Module Program
    Sub Main()
        ComponentInfo.SetLicense("FREE-LIMITED-KEY")

        Using document As New PdfDocument()
            Dim source1 = PdfDocument.Load("document1.pdf")
            Dim source2 = PdfDocument.Load("document2.pdf")

            document.Pages.AddClone(source1.Pages)
            document.Pages.AddClone(source2.Pages)

            document.Save("merged.pdf")
        End Using
    End Sub
End Module
$vbLabelText   $csharpLabel

이후 (IronPDF):

// NuGet: Install-Package IronPdf
using IronPdf;

class Program
{
    static void Main()
    {
        var pdf1 = PdfDocument.FromFile("document1.pdf");
        var pdf2 = PdfDocument.FromFile("document2.pdf");

        var merged = PdfDocument.Merge(pdf1, pdf2);
        merged.SaveAs("merged.pdf");
    }
}
// NuGet: Install-Package IronPdf
using IronPdf;

class Program
{
    static void Main()
    {
        var pdf1 = PdfDocument.FromFile("document1.pdf");
        var pdf2 = PdfDocument.FromFile("document2.pdf");

        var merged = PdfDocument.Merge(pdf1, pdf2);
        merged.SaveAs("merged.pdf");
    }
}
Imports IronPdf

Class Program
    Shared Sub Main()
        Dim pdf1 = PdfDocument.FromFile("document1.pdf")
        Dim pdf2 = PdfDocument.FromFile("document2.pdf")

        Dim merged = PdfDocument.Merge(pdf1, pdf2)
        merged.SaveAs("merged.pdf")
    End Sub
End Class
$vbLabelText   $csharpLabel

IronPDF의 정적 Merge 메소드는 작업을 간소화하여 빈 문서를 생성하고 페이지를 개별적으로 복제할 필요가 없습니다. PDF 병합 및 분할에 대해 더 알아보세요.

예제 3: PDF에 텍스트 추가

이전 (GemBox.Pdf):

// NuGet: Install-Package GemBox.Pdf
using GemBox.Pdf;
using GemBox.Pdf.Content;

class Program
{
    static void Main()
    {
        ComponentInfo.SetLicense("FREE-LIMITED-KEY");

        using (var document = new PdfDocument())
        {
            var page = document.Pages.Add();
            // PdfFormattedText has no Text property; use Append/AppendLine.
            var formattedText = new PdfFormattedText();
            formattedText.FontSize = 24;
            formattedText.Append("Hello World");

            page.Content.DrawText(formattedText, new PdfPoint(100, 700));
            document.Save("output.pdf");
        }
    }
}
// NuGet: Install-Package GemBox.Pdf
using GemBox.Pdf;
using GemBox.Pdf.Content;

class Program
{
    static void Main()
    {
        ComponentInfo.SetLicense("FREE-LIMITED-KEY");

        using (var document = new PdfDocument())
        {
            var page = document.Pages.Add();
            // PdfFormattedText has no Text property; use Append/AppendLine.
            var formattedText = new PdfFormattedText();
            formattedText.FontSize = 24;
            formattedText.Append("Hello World");

            page.Content.DrawText(formattedText, new PdfPoint(100, 700));
            document.Save("output.pdf");
        }
    }
}
Imports GemBox.Pdf
Imports GemBox.Pdf.Content

Module Program

    Sub Main()
        ComponentInfo.SetLicense("FREE-LIMITED-KEY")

        Using document As New PdfDocument()
            Dim page = document.Pages.Add()
            ' PdfFormattedText has no Text property; use Append/AppendLine.
            Dim formattedText As New PdfFormattedText()
            formattedText.FontSize = 24
            formattedText.Append("Hello World")

            page.Content.DrawText(formattedText, New PdfPoint(100, 700))
            document.Save("output.pdf")
        End Using
    End Sub

End Module
$vbLabelText   $csharpLabel

이후 (IronPDF):

// NuGet: Install-Package IronPdf
using IronPdf;
using IronPdf.Editing;

class Program
{
    static void Main()
    {
        var renderer = new ChromePdfRenderer();
        var pdf = renderer.RenderHtmlAsPdf("<p>Original Content</p>");

        var stamper = new TextStamper()
        {
            Text = "Hello World",
            FontSize = 24,
            HorizontalOffset = 100,
            VerticalOffset = 700
        };

        pdf.ApplyStamp(stamper);
        pdf.SaveAs("output.pdf");
    }
}
// NuGet: Install-Package IronPdf
using IronPdf;
using IronPdf.Editing;

class Program
{
    static void Main()
    {
        var renderer = new ChromePdfRenderer();
        var pdf = renderer.RenderHtmlAsPdf("<p>Original Content</p>");

        var stamper = new TextStamper()
        {
            Text = "Hello World",
            FontSize = 24,
            HorizontalOffset = 100,
            VerticalOffset = 700
        };

        pdf.ApplyStamp(stamper);
        pdf.SaveAs("output.pdf");
    }
}
Imports IronPdf
Imports IronPdf.Editing

Class Program
    Shared Sub Main()
        Dim renderer = New ChromePdfRenderer()
        Dim pdf = renderer.RenderHtmlAsPdf("<p>Original Content</p>")

        Dim stamper = New TextStamper() With {
            .Text = "Hello World",
            .FontSize = 24,
            .HorizontalOffset = 100,
            .VerticalOffset = 700
        }

        pdf.ApplyStamp(stamper)
        pdf.SaveAs("output.pdf")
    End Sub
End Class
$vbLabelText   $csharpLabel

기존 PDF에 텍스트를 추가하려면 IronPDF는 정확한 위치 제어를 제공하는 TextStamper 클래스를 제공합니다. 새 문서의 경우, HTML 템플릿에 텍스트를 포함시키십시오. 스탬핑 문서에서 추가 옵션을 확인하십시오.

예제 4: 테이블 생성 (가장 큰 개선 사항!)

Before (GemBox.Pdf) — 좌표 기반 레이아웃, 무료 모드에서 2페이지로 제한:

using GemBox.Pdf;
using GemBox.Pdf.Content;

ComponentInfo.SetLicense("FREE-LIMITED-KEY");

using (var document = new PdfDocument())
{
    var page = document.Pages.Add();
    double y = 700;
    double[] xPositions = { 50, 200, 300, 400 };

    // Headers
    var headers = new[] { "Product", "Price", "Qty", "Total" };
    for (int i = 0; i < headers.Length; i++)
    {
        var text = new PdfFormattedText();
        text.FontSize = 12;
        text.Append(headers[i]);
        page.Content.DrawText(text, new PdfPoint(xPositions[i], y));
    }
    y -= 20;

    // Data rows — each row requires manual Y advancement,
    // and free mode caps the saved file at 2 pages total.

    document.Save("products.pdf");
}
using GemBox.Pdf;
using GemBox.Pdf.Content;

ComponentInfo.SetLicense("FREE-LIMITED-KEY");

using (var document = new PdfDocument())
{
    var page = document.Pages.Add();
    double y = 700;
    double[] xPositions = { 50, 200, 300, 400 };

    // Headers
    var headers = new[] { "Product", "Price", "Qty", "Total" };
    for (int i = 0; i < headers.Length; i++)
    {
        var text = new PdfFormattedText();
        text.FontSize = 12;
        text.Append(headers[i]);
        page.Content.DrawText(text, new PdfPoint(xPositions[i], y));
    }
    y -= 20;

    // Data rows — each row requires manual Y advancement,
    // and free mode caps the saved file at 2 pages total.

    document.Save("products.pdf");
}
Imports GemBox.Pdf
Imports GemBox.Pdf.Content

ComponentInfo.SetLicense("FREE-LIMITED-KEY")

Using document As New PdfDocument()
    Dim page = document.Pages.Add()
    Dim y As Double = 700
    Dim xPositions As Double() = {50, 200, 300, 400}

    ' Headers
    Dim headers = New String() {"Product", "Price", "Qty", "Total"}
    For i As Integer = 0 To headers.Length - 1
        Dim text As New PdfFormattedText()
        text.FontSize = 12
        text.Append(headers(i))
        page.Content.DrawText(text, New PdfPoint(xPositions(i), y))
    Next
    y -= 20

    ' Data rows — each row requires manual Y advancement,
    ' and free mode caps the saved file at 2 pages total.

    document.Save("products.pdf")
End Using
$vbLabelText   $csharpLabel

After (IronPDF) — 페이지 제한 없음, 적절한 HTML 테이블:

using IronPdf;

IronPdf.License.LicenseKey = "YOUR-LICENSE-KEY";

var html = @"
    <html>
    <head>
        <style>
            table { border-collapse: collapse; width: 100%; }
            th, td { border: 1px solid #ddd; padding: 8px; text-align: left; }
            th { background-color: #4CAF50; color: white; }
            tr:nth-child(even) { background-color: #f2f2f2; }
        </style>
    </head>
    <body>
        <table>
            <thead>
                <tr>
                    <th>Product</th>
                    <th>Price</th>
                    <th>Qty</th>
                    <th>Total</th>
                </tr>
            </thead>
            <tbody>
                <tr><td>Widget A</td><td>$19.99</td><td>5</td><td>$99.95</td></tr>
                <tr><td>Widget B</td><td>$29.99</td><td>3</td><td>$89.97</td></tr>

            </tbody>
        </table>
    </body>
    </html>";

var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderHtmlAsPdf(html);
pdf.SaveAs("products.pdf");
using IronPdf;

IronPdf.License.LicenseKey = "YOUR-LICENSE-KEY";

var html = @"
    <html>
    <head>
        <style>
            table { border-collapse: collapse; width: 100%; }
            th, td { border: 1px solid #ddd; padding: 8px; text-align: left; }
            th { background-color: #4CAF50; color: white; }
            tr:nth-child(even) { background-color: #f2f2f2; }
        </style>
    </head>
    <body>
        <table>
            <thead>
                <tr>
                    <th>Product</th>
                    <th>Price</th>
                    <th>Qty</th>
                    <th>Total</th>
                </tr>
            </thead>
            <tbody>
                <tr><td>Widget A</td><td>$19.99</td><td>5</td><td>$99.95</td></tr>
                <tr><td>Widget B</td><td>$29.99</td><td>3</td><td>$89.97</td></tr>

            </tbody>
        </table>
    </body>
    </html>";

var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderHtmlAsPdf(html);
pdf.SaveAs("products.pdf");
Imports IronPdf

IronPdf.License.LicenseKey = "YOUR-LICENSE-KEY"

Dim html As String = "
    <html>
    <head>
        <style>
            table { border-collapse: collapse; width: 100%; }
            th, td { border: 1px solid #ddd; padding: 8px; text-align: left; }
            th { background-color: #4CAF50; color: white; }
            tr:nth-child(even) { background-color: #f2f2f2; }
        </style>
    </head>
    <body>
        <table>
            <thead>
                <tr>
                    <th>Product</th>
                    <th>Price</th>
                    <th>Qty</th>
                    <th>Total</th>
                </tr>
            </thead>
            <tbody>
                <tr><td>Widget A</td><td>$19.99</td><td>5</td><td>$99.95</td></tr>
                <tr><td>Widget B</td><td>$29.99</td><td>3</td><td>$89.97</td></tr>

            </tbody>
        </table>
    </body>
    </html>"

Dim renderer As New ChromePdfRenderer()
Dim pdf = renderer.RenderHtmlAsPdf(html)
pdf.SaveAs("products.pdf")
$vbLabelText   $csharpLabel

이것이 GemBox.Pdf 마이그레이션에서 가장 중요한 개선 사항입니다. 2페이지 상한을 넘어가는 무료 모드 GemBox.Pdf 문서를 IronPDF에서는 그 상한 없이 렌더링하며, 전체 CSS 스타일링 지원이 가능합니다.


중요한 마이그레이션 노트

좌표에서 CSS 위치 지정으로

픽셀 단위의 완벽한 위치를 원하신다면 (GemBox.Pdf의 좌표 시스템과 유사), CSS 절대 포지셔닝을 사용하세요:

<div style="position:absolute; left:50px; top:750px; font-size:24px;">
    Text positioned at specific coordinates
</div>
<div style="position:absolute; left:50px; top:750px; font-size:24px;">
    Text positioned at specific coordinates
</div>
HTML

페이지 색인화

GemBox.Pdf와IronPDF모두 0부터 시작하는 페이지를 사용하므로 마이그레이션이 쉬워집니다:

// GemBox.Pdf
var page = document.Pages[0];

// IronPDF
var page = pdf.Pages[0];
// GemBox.Pdf
var page = document.Pages[0];

// IronPDF
var page = pdf.Pages[0];
' GemBox.Pdf
Dim page = document.Pages(0)

' IronPDF
Dim page = pdf.Pages(0)
$vbLabelText   $csharpLabel

보안 설정

// GemBox.Pdf
var encryption = document.SaveOptions.SetPasswordEncryption();
encryption.DocumentOpenPassword = "userPassword";
encryption.PermissionsPassword = "ownerPassword";

// IronPDF
pdf.SecuritySettings.UserPassword = "userPassword";
pdf.SecuritySettings.OwnerPassword = "ownerPassword";
// GemBox.Pdf
var encryption = document.SaveOptions.SetPasswordEncryption();
encryption.DocumentOpenPassword = "userPassword";
encryption.PermissionsPassword = "ownerPassword";

// IronPDF
pdf.SecuritySettings.UserPassword = "userPassword";
pdf.SecuritySettings.OwnerPassword = "ownerPassword";
' GemBox.Pdf
Dim encryption = document.SaveOptions.SetPasswordEncryption()
encryption.DocumentOpenPassword = "userPassword"
encryption.PermissionsPassword = "ownerPassword"

' IronPDF
pdf.SecuritySettings.UserPassword = "userPassword"
pdf.SecuritySettings.OwnerPassword = "ownerPassword"
$vbLabelText   $csharpLabel

문제 해결

문제 1: PdfFormattedText 찾을 수 없음

문제: IronPDF에 PdfFormattedText가 존재하지 않습니다.

해결책: CSS 스타일링과 함께 HTML을 사용하십시오:

// GemBox.Pdf
var text = new PdfFormattedText();
text.FontSize = 24;
text.Append("Hello");

// IronPDF
var html = "<p style='font-size:24px;'>Hello</p>";
var pdf = renderer.RenderHtmlAsPdf(html);
// GemBox.Pdf
var text = new PdfFormattedText();
text.FontSize = 24;
text.Append("Hello");

// IronPDF
var html = "<p style='font-size:24px;'>Hello</p>";
var pdf = renderer.RenderHtmlAsPdf(html);
Imports GemBox.Pdf
Imports IronPDF

Dim text As New PdfFormattedText()
text.FontSize = 24
text.Append("Hello")

Dim html As String = "<p style='font-size:24px;'>Hello</p>"
Dim pdf = renderer.RenderHtmlAsPdf(html)
$vbLabelText   $csharpLabel

문제 2: DrawText 메서드 찾을 수 없음

문제: page.Content.DrawText()를 사용할 수 없습니다.

해결책: HTML 렌더링을 통해 콘텐츠를 생성하거나 스탬퍼를 사용하십시오:

// For new documents - render HTML
var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderHtmlAsPdf("<h1>Content</h1>");

// For existing documents - use stampers
var stamper = new TextStamper() { Text = "Added Text" };
pdf.ApplyStamp(stamper);
// For new documents - render HTML
var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderHtmlAsPdf("<h1>Content</h1>");

// For existing documents - use stampers
var stamper = new TextStamper() { Text = "Added Text" };
pdf.ApplyStamp(stamper);
Imports System

' For new documents - render HTML
Dim renderer As New ChromePdfRenderer()
Dim pdf = renderer.RenderHtmlAsPdf("<h1>Content</h1>")

' For existing documents - use stampers
Dim stamper As New TextStamper() With {.Text = "Added Text"}
pdf.ApplyStamp(stamper)
$vbLabelText   $csharpLabel

문제 3: 문서 로딩 차이

문제: PdfDocument.Load()를 찾을 수 없습니다.

해결책: PdfDocument.FromFile() 또는 FromStream()를 사용하십시오:

// GemBox.Pdf
var doc = PdfDocument.Load("input.pdf");

// IronPDF
var pdf = PdfDocument.FromFile("input.pdf");
// GemBox.Pdf
var doc = PdfDocument.Load("input.pdf");

// IronPDF
var pdf = PdfDocument.FromFile("input.pdf");
Imports GemBox.Pdf
Imports IronPdf

Dim doc = PdfDocument.Load("input.pdf")

Dim pdf = PdfDocument.FromFile("input.pdf")
$vbLabelText   $csharpLabel

문제 4: Save 메서드 차이

문제: document.Save() 메소드 서명이 다릅니다.

해결책: SaveAs()를 사용하십시오:

// GemBox.Pdf
document.Save("output.pdf");

// IronPDF
pdf.SaveAs("output.pdf");
// GemBox.Pdf
document.Save("output.pdf");

// IronPDF
pdf.SaveAs("output.pdf");
$vbLabelText   $csharpLabel

마이그레이션 체크리스트

사전 마이그레이션

  • 코드베이스 내 모든 GemBox.Pdf 사용 내역
  • HTML 변환이 필요한 좌표 기반 레이아웃 식별
  • 2페이지 무료 모드 제한이 코드에 미치는 영향 평가 -IronPDF라이센스 키를 받으세요
  • 버전 컨트롤에 마이그레이션 분기를 생성

코드 마이그레이션

  • GemBox.Pdf NuGet 패키지를 제거합니다: dotnet remove package GemBox.Pdf -IronPDF NuGet 패키지를 설치합니다: dotnet add package IronPdf
  • 네임스페이스 가져오기 업데이트
  • ComponentInfo.SetLicense()IronPdf.License.LicenseKey로 대체합니다
  • PdfDocument.Load()PdfDocument.FromFile()로 변환합니다
  • document.Save()pdf.SaveAs()로 변환합니다
  • 좌표 기반 텍스트를 HTML 콘텐츠로 대체
  • PdfFormattedText를 CSS 스타일링으로 HTML로 변환합니다
  • 병합 작업을 PdfDocument.Merge()를 사용하도록 업데이트합니다

테스트

  • 모든 문서가 올바르게 생성되는지 확인하세요
  • 문서의 외관이 기대에 부합하는지 검증하세요
  • 다중 페이지 출력 테스트 (이전에 무료 모드에서 2페이지로 제한됨)
  • 텍스트 추출이 올바르게 작동하는지 확인하세요
  • 병합 및 분할 작업을 테스트하세요
  • 보안/암호화 기능을 검증하세요

마이그레이션 이후

  • GemBox.Pdf 라이선스 키 제거
  • 문서 업데이트
  • 팀을 HTML/CSS 방식으로 PDF에 대한 교육을 시키세요
  • 무료 모드 제한 없이 무제한 페이지 수 즐기기!

참고해 주세요GemBox.Pdf는 해당 소유자의 등록 상표입니다. 이 사이트는 GemBox Software Ltd와 제휴하거나, 인증받거나, 후원받지 않았습니다. 모든 제품명, 로고 및 브랜드는 각각의 소유자의 자산입니다. 비교는 정보 제공 목적으로만 사용되며, 작성 시점에 공개적으로 이용 가능한 정보를 반영합니다.

Curtis Chau
기술 문서 작성자

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

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

아이언 서포트 팀

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