Skip to footer content
MIGRATION GUIDES

How to Migrate from GemBox PDF to IronPDF in C#

Migrating from GemBox.Pdf to IronPDF transforms your .NET PDF workflow from coordinate-based, programmatic document construction to modern HTML/CSS-based rendering. This guide provides a comprehensive, step-by-step migration path that removes the 2-page free-mode cap and simplifies document creation for professional .NET developers.

Why Migrate from GemBox.Pdf to IronPDF

The GemBox.Pdf Challenges

GemBox.Pdf is a capable .NET PDF component, but it has limitations worth weighing for real-world development:

  1. 2-Page Free-Mode Limit: The free version throws FreeLimitReachedException when loading or saving a PDF beyond 2 pages, so anything past a one-page receipt or two-page invoice requires a paid license. (Source: gemboxsoftware.com/pdf/free-version.)

  2. No HTML-to-PDF Conversion: GemBox.Pdf cannot render HTML — PdfDocument.Load only opens existing PDF files. To convert HTML to PDF you have to buy the separate GemBox.Document product (different SKU, different license).

  3. Coordinate-Based Layout: GemBox.Pdf is a low-level PDF content-stream API. To place text you calculate X/Y in PDF user-space units and call page.Content.DrawText(formattedText, new PdfPoint(x, y)). There is no flow layout.

  4. Office-to-PDF Requires Other SKUs: Word→PDF needs GemBox.Document, Excel→PDF needs GemBox.Spreadsheet, each licensed separately; the GemBox.Bundle covers all of them but costs more.

  5. Programmatic Only: Every design change requires code changes. Tweak spacing? Recalculate coordinates. Change a font size? Adjust the Y positions below it.

  6. Commercial-License Pricing: Single-developer license is $890 (renewal $534), small-team (10 devs) is $4,450, large-team (50 devs) is $13,350. (Source: gemboxsoftware.com/pdf/pricing.)

  7. Learning Curve for Design: Developers must think in coordinates rather than document flow, making simple tasks like "add a paragraph" surprisingly involved.

GemBox.Pdf vs IronPDF Comparison

Aspect GemBox.Pdf IronPDF
Free Version Limits 2-page max (FreeLimitReachedException) Watermark only, no page cap
HTML-to-PDF Not supported (need GemBox.Document) Full Chromium engine
Word/Excel → PDF Separate SKUs (GemBox.Document / GemBox.Spreadsheet) Render via HTML pipeline
Layout Approach Coordinate-based, manual HTML/CSS flow layout
Modern CSS Not applicable Flexbox, Grid, CSS3 animations
JavaScript Support Not applicable Full JavaScript execution
Design Changes Recalculate coordinates Edit HTML/CSS
Learning Curve PDF coordinate system HTML/CSS (web familiar)

IronPDF leverages familiar web technologies for PDF generation on modern .NET.


Migration Complexity Assessment

Estimated Effort by Feature

Feature Migration Complexity
Load/Save PDFs Very Low
Merge PDFs Very Low
Split PDFs Low
Text Extraction Very Low
Add Text Medium
Tables Low
Images Low
Watermarks Low
Password Protection Medium
Form Fields Medium

Paradigm Shift

The biggest change in this GemBox.Pdf migration is moving from coordinate-based layout to HTML/CSS layout:

GemBox.Pdf:  "Draw text at position (100, 700)"
IronPDF:     "Render this HTML with CSS styling"

This paradigm shift is generally easier for developers familiar with web technologies, but requires thinking about PDFs differently.


Before You Start

Prerequisites

  1. .NET Version: IronPDF supports .NET Framework 4.6.2+ and .NET Core 2.0+ / .NET 5+
  2. License Key: Obtain your IronPDF license key from ironpdf.com
  3. Backup: Create a branch for migration work
  4. HTML/CSS Knowledge: Basic familiarity helpful but not required

Identify All GemBox.Pdf Usage

# 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 Package Changes

# 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

Quick Start Migration

Step 1: Update License Configuration

Before (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

After (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

Step 2: Update Namespace Imports

// 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

Step 3: Basic Conversion Pattern

Before (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

After (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

Key Differences:

  • No coordinate calculations needed
  • HTML/CSS instead of programmatic layout
  • No 2-page free-mode ceiling
  • Simpler, more readable code

Complete API Reference

Namespace Mapping

GemBox.Pdf IronPDF
GemBox.Pdf IronPdf
GemBox.Pdf.Content IronPdf (content is HTML)
GemBox.Pdf.Security IronPdf (SecuritySettings)
GemBox.Pdf.Forms IronPdf.Forms

Core Class Mapping

GemBox.Pdf IronPDF Description
PdfDocument PdfDocument Main PDF document class
PdfPage PdfDocument.Pages[i] Page representation
PdfContent N/A (use HTML) Page content
PdfFormattedText N/A (use HTML) Formatted text
PdfPoint N/A (use CSS positioning) Coordinate positioning
ComponentInfo.SetLicense() IronPdf.License.LicenseKey License management

Document Operations

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 (returns byte[])

Page Operations

GemBox.Pdf IronPDF
document.Pages.Add() Create via HTML rendering
document.Pages.Count pdf.PageCount
document.Pages[index] pdf.Pages[index]
document.Pages.AddClone(pages) PdfDocument.Merge()

Text and Content Operations

GemBox.Pdf IronPDF
new PdfFormattedText() HTML string
formattedText.Append(text) Include in HTML
formattedText.AppendLine(text) Include in 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)

Code Migration Examples

Example 1: HTML to PDF Conversion

Before (GemBox.Pdf) — not supported by GemBox.Pdf; requires the separate 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

After (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's ChromePdfRenderer uses a modern Chromium engine for HTML/CSS/JavaScript rendering, so a single NuGet package covers HTML-to-PDF directly — no separate SKU. See the HTML to PDF documentation for more rendering options.

Example 2: Merge PDF Files

Before (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

After (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's static Merge method simplifies the operation—no need to create an empty document and clone pages individually. Learn more about merging and splitting PDFs.

Example 3: Add Text to PDF

Before (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

After (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

For adding text to existing PDFs, IronPDF provides the TextStamper class which offers precise positioning control. For new documents, simply include the text in your HTML template. See the stamping documentation for additional options.

Example 4: Creating Tables (The Biggest Improvement!)

Before (GemBox.Pdf) — coordinate-based layout, capped at 2 pages in free mode:

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) — no page cap, proper HTML tables:

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

This is the most significant improvement in the GemBox.Pdf migration. Tables that would push a free-mode GemBox.Pdf document past the 2-page cap render without that cap in IronPDF, with full CSS styling support.


Critical Migration Notes

Coordinate to CSS Positioning

If you need pixel-perfect positioning (similar to GemBox.Pdf's coordinate system), use CSS absolute positioning:

<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

Page Indexing

Both GemBox.Pdf and IronPDF use 0-indexed pages, making this aspect of the migration straightforward:

// 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

Security Settings

// 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

Troubleshooting

Issue 1: PdfFormattedText Not Found

Problem: PdfFormattedText doesn't exist in IronPDF.

Solution: Use HTML with CSS styling:

// 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

Issue 2: DrawText Method Not Found

Problem: page.Content.DrawText() not available.

Solution: Create content via HTML rendering or use stampers:

// 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

Issue 3: Document Loading Differences

Problem: PdfDocument.Load() not found.

Solution: Use PdfDocument.FromFile() or 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

Issue 4: Save Method Differences

Problem: document.Save() method signature differs.

Solution: Use 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

Migration Checklist

Pre-Migration

  • Inventory all GemBox.Pdf usage in codebase
  • Identify coordinate-based layouts that need HTML conversion
  • Evaluate where the 2-page free-mode cap affects your code
  • Obtain IronPDF license key
  • Create migration branch in version control

Code Migration

  • Remove GemBox.Pdf NuGet package: dotnet remove package GemBox.Pdf
  • Install IronPDF NuGet package: dotnet add package IronPdf
  • Update namespace imports
  • Replace ComponentInfo.SetLicense() with IronPdf.License.LicenseKey
  • Convert PdfDocument.Load() to PdfDocument.FromFile()
  • Convert document.Save() to pdf.SaveAs()
  • Replace coordinate-based text with HTML content
  • Convert PdfFormattedText to HTML with CSS styling
  • Update merge operations to use PdfDocument.Merge()

Testing

  • Verify all documents generate correctly
  • Validate document appearance matches expectations
  • Test multi-page output (previously capped at 2 pages in free mode)
  • Verify text extraction works correctly
  • Test merge and split operations
  • Validate security/encryption functionality

Post-Migration

  • Remove GemBox.Pdf license keys
  • Update documentation
  • Train team on HTML/CSS approach for PDFs
  • Enjoy unlimited page counts without a free-mode cap!

Please noteGemBox.Pdf is a registered trademark of its respective owner. This site is not affiliated with, endorsed by, or sponsored by GemBox Software Ltd. All product names, logos, and brands are property of their respective owners. Comparisons are for informational purposes only and reflect publicly available information at the time of writing.

Curtis Chau
Technical Writer

Curtis Chau holds a Bachelor’s degree in Computer Science (Carleton University) and specializes in front-end development with expertise in Node.js, TypeScript, JavaScript, and React. Passionate about crafting intuitive and aesthetically pleasing user interfaces, Curtis enjoys working with modern frameworks and creating well-structured, visually appealing manuals.

...

Read More

Iron Support Team

We're online 24 hours, 5 days a week.
Chat
Email
Call Me