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

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

GemBox PDF에서 IronPDF로의 마이그레이션은 .NET PDF 워크플로를 좌표 기반, 프로그래밍 문서 구성에서 최신 HTML/CSS 기반 렌더링으로 변환합니다. 이 가이드는 단락 제한을 제거하고 .NET 개발자가 문서 작성을 단순화하기 위한 포괄적이고 단계적인 마이그레이션 경로를 제공합니다.

GemBox PDF에서 IronPDF로 마이그레이션해야 하는 이유

GemBox PDF의 문제점

GemBox PDF는 유능한 .NET PDF 컴포넌트이지만, 실제 개발에 영향을 미치는 중요한 제한 사항이 있습니다:

  1. 무료 버전의 20단락 제한: 무료 버전은 20개의 단락으로 제한되며, 테이블 셀도 이 제한에 포함됩니다. 간단한 10행 5열 테이블은 50개의 '단락'을 사용하므로, 무료 버전은 기본 비즈니스 문서에서도 사용할 수 없습니다.

  2. HTML-에서 PDF로의 변환 없음: GemBox PDF는 프로그래밍 문서 구성이 필요합니다. 모든 요소의 좌표를 계산하고 수동으로 위치를 지정해야 하며, '이 HTML을 렌더'하는 간단한 기능이 없습니다.

  3. 좌표 기반 레이아웃: HTML/CSS와 달리 레이아웃이 자연스럽게 흐르는 대신, GemBox PDF는 각 텍스트 요소, 이미지, 도형에 대해 정확한 X/Y 위치를 계산해야 합니다.

  4. 제한된 기능 세트: 포괄적인 PDF 라이브러리와 비교할 때, GemBox PDF는 고급 기능 없이 읽기, 쓰기, 병합, 분할과 같은 기본 작업에 집중합니다.

  5. 프로그램 방식만 지원: 모든 디자인 변경은 코드 변경이 필요합니다. 여백을 조정하고 싶으세요? 좌표를 재계산하세요. 다른 글꼴 크기를 원하시나요? 그 아래의 모든 Y 위치를 조정하세요.

  6. 테이블 셀 계산: 단락 제한은 테이블 셀도 셉니다. 이것이 테이블이 있는 문서에 대해 무료 버전을 사실상 쓸모없게 만듭니다.

  7. 디자인 학습 곡선: 개발자는 문서 흐름이 아닌 좌표로 생각해야 하며, '단락 추가'와 같은 간단한 작업도 놀라울 만큼 복잡해집니다.

GemBox PDF와 IronPDF의 비교

측면 GemBox PDF IronPDF
무료 버전 제한 20 단락 (테이블 셀 포함) 워터마크만, 콘텐츠 제한 없음
HTML-to-PDF 지원되지 않음 전체 Chromium 엔진
레이아웃 접근 방식 좌표 기반, 수동 HTML/CSS 흐름 레이아웃
문단 제한에 포함 무제한, HTML 테이블 사용
최신 CSS 적용 안 됨 Flexbox, 그리드, CSS3 애니메이션
JavaScript 지원 적용 안 됨 완전한 JavaScript 실행
디자인 변경 좌표 재계산 HTML/CSS 편집
학습 곡선 PDF 좌표 시스템 HTML/CSS (웹 익숙함)

.NET 10 및 C# 14 채택을 2025년 및 2026년까지 계획 중인 팀은 IronPDF가 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/6/7/8/9+를 지원합니다.
  2. 라이선스 키: ironpdf.com에서IronPDF라이선스 키를 얻으세요.
  3. 백업: 마이그레이션 작업을 위한 분기를 생성하세요.
  4. HTML/CSS 지식: 기본적인 친숙함은 도움이 되지만 필수는 아님

모든GemBox PDF사용 식별

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

# Find package references
grep -r "GemBox\.Pdf" --include="*.csproj" .
# Find allGemBox PDFreferences
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 anyGemBox PDFoperations
ComponentInfo.SetLicense("FREE-LIMITED-KEY");
// Or for professional:
ComponentInfo.SetLicense("YOUR-PROFESSIONAL-LICENSE");
// Must call before anyGemBox PDFoperations
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-IRONPDF-LICENSE-KEY";

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

// Or in appsettings.json:
// { "IronPdf.License.LicenseKey": "YOUR-LICENSE-KEY" }
' Set once at application startup
IronPdf.License.LicenseKey = "YOUR-IRONPDF-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();
    var formattedText = new PdfFormattedText()
    {
        Text = "Hello World",
        FontSize = 24
    };

    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();
    var formattedText = new PdfFormattedText()
    {
        Text = "Hello World",
        FontSize = 24
    };

    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()
    Dim formattedText As New PdfFormattedText() With {
        .Text = "Hello World",
        .FontSize = 24
    }

    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 사용
  • 단락 제한 없음
  • 더 간단하고 읽기 쉬운 코드

완전한 API 참조

네임스페이스 매핑

GemBox PDF IronPDF
GemBox.Pdf IronPdf
GemBox.Pdf.Content IronPdf (내용은 HTML입니다)
GemBox.Pdf.Security IronPdf (보안 설정)
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.Stream 또는 pdf.BinaryData

페이지 작업

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.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로 변환

비교 전에 (GemBox PDF):

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

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

        var document = PdfDocument.Load("input.html");
        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");

        var document = PdfDocument.Load("input.html");
        document.Save("output.pdf");
    }
}
Imports GemBox.Pdf
Imports GemBox.Pdf.Content

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

        Dim document = PdfDocument.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는 정확한 HTML/CSS/JavaScript 렌더링을 위해 최신 Chromium 엔진을 사용합니다. GemBox PDF의 제한된 HTML 지원과 달리, IronPDF는 전체 CSS3 및 JavaScript 지원으로 모든 HTML 콘텐츠를 렌더링할 수 있습니다. 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();
            var formattedText = new PdfFormattedText()
            {
                Text = "Hello World",
                FontSize = 24
            };

            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();
            var formattedText = new PdfFormattedText()
            {
                Text = "Hello World",
                FontSize = 24
            };

            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()
            Dim formattedText As New PdfFormattedText() With {
                .Text = "Hello World",
                .FontSize = 24
            }

            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: 테이블 생성 (가장 큰 개선 사항!)

이전 (GemBox PDF) - 각 셀이 20개 단락 제한에 포함됨:

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 (4 paragraphs)
    var headers = new[] { "Product", "Price", "Qty", "Total" };
    for (int i = 0; i < headers.Length; i++)
    {
        var text = new PdfFormattedText { Text = headers[i], FontSize = 12 };
        page.Content.DrawText(text, new PdfPoint(xPositions[i], y));
    }
    y -= 20;

    // Data rows (4 paragraphs per row!)
    // Can only add a few rows before hitting 20-paragraph limit!

    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 (4 paragraphs)
    var headers = new[] { "Product", "Price", "Qty", "Total" };
    for (int i = 0; i < headers.Length; i++)
    {
        var text = new PdfFormattedText { Text = headers[i], FontSize = 12 };
        page.Content.DrawText(text, new PdfPoint(xPositions[i], y));
    }
    y -= 20;

    // Data rows (4 paragraphs per row!)
    // Can only add a few rows before hitting 20-paragraph limit!

    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 (4 paragraphs)
    Dim headers = {"Product", "Price", "Qty", "Total"}
    For i As Integer = 0 To headers.Length - 1
        Dim text As New PdfFormattedText With {.Text = headers(i), .FontSize = 12}
        page.Content.DrawText(text, New PdfPoint(xPositions(i), y))
    Next
    y -= 20

    ' Data rows (4 paragraphs per row!)
    ' Can only add a few rows before hitting 20-paragraph limit!

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

이후 (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마이그레이션에서 가장 중요한 개선 사항입니다. 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
document.SaveOptions.SetPasswordEncryption(userPassword, ownerPassword);

// IronPDF
pdf.SecuritySettings.UserPassword = "userPassword";
pdf.SecuritySettings.OwnerPassword = "ownerPassword";
// GemBox PDF
document.SaveOptions.SetPasswordEncryption(userPassword, ownerPassword);

// IronPDF
pdf.SecuritySettings.UserPassword = "userPassword";
pdf.SecuritySettings.OwnerPassword = "ownerPassword";
' GemBox PDF
document.SaveOptions.SetPasswordEncryption(userPassword, ownerPassword)

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

문제 해결

문제 1: PdfFormattedText 찾을 수 없음

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

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

// GemBox PDF
var text = new PdfFormattedText { Text = "Hello", FontSize = 24 };

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

// IronPDF
var html = "<p style='font-size:24px;'>Hello</p>";
var pdf = renderer.RenderHtmlAsPdf(html);
' GemBox PDF
Dim text As New PdfFormattedText With {.Text = "Hello", .FontSize = 24}

' IronPDF
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");
' GemBox PDF
document.Save("output.pdf")

' IronPDF
pdf.SaveAs("output.pdf")
$vbLabelText   $csharpLabel

마이그레이션 체크리스트

사전 마이그레이션

  • 코드베이스의 모든GemBox PDF사용내역 조사
  • HTML 변환이 필요한 좌표 기반 레이아웃 식별
  • 코드를 영향을 미치는 현재의 단락 제한 평가 -IronPDF라이센스 키를 받으세요
  • 버전 컨트롤에 마이그레이션 분기를 생성

코드 마이그레이션

-GemBox PDFNuGet 패키지를 제거: 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() 를 사용하도록 업데이트

테스트

  • 모든 문서가 올바르게 생성되는지 확인하세요
  • 문서의 외관이 기대에 부합하는지 검증하세요
  • 테이블 생성 테스트 (이전에 20개의 단락 규정에 제한됨)
  • 텍스트 추출이 올바르게 작동하는지 확인하세요
  • 병합 및 분할 작업을 테스트하세요
  • 보안/암호화 기능을 검증하세요

마이그레이션 이후

-GemBox PDF라이선스 키를 제거하세요

  • 문서 업데이트
  • 팀을 HTML/CSS 방식으로 PDF에 대한 교육을 시키세요
  • 단락 제한 없이 무제한 콘텐츠를 즐기세요!

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

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

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

아이언 서포트 팀

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