IRONSOFTWAREHOME
MIGRATION GUIDES

How to Migrate from GemBox PDF to IronPDF in C#

Curtis Chau
Curtis Chau
Updated: August 1, 2026

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

AspectGemBox.PdfIronPDF
Free Version Limits2-page max (FreeLimitReachedException)Watermark only, no page cap
HTML-to-PDFNot supported (need GemBox.Document)Full Chromium engine
Word/Excel → PDFSeparate SKUs (GemBox.Document / GemBox.Spreadsheet)Render via HTML pipeline
Layout ApproachCoordinate-based, manualHTML/CSS flow layout
Modern CSSNot applicableFlexbox, Grid, CSS3 animations
JavaScript SupportNot applicableFull JavaScript execution
Design ChangesRecalculate coordinatesEdit HTML/CSS
Learning CurvePDF coordinate systemHTML/CSS (web familiar)

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


Migration Complexity Assessment

Estimated Effort by Feature

FeatureMigration Complexity
Load/Save PDFsVery Low
Merge PDFsVery Low
Split PDFsLow
Text ExtractionVery Low
Add TextMedium
TablesLow
ImagesLow
WatermarksLow
Password ProtectionMedium
Form FieldsMedium

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"
Text

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" .
SHELL

NuGet Package Changes

# 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");

After (IronPDF):

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

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

Step 2: Update Namespace Imports

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

// After (IronPDF)
using IronPdf;
using IronPdf.Editing;

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");
}

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");

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.PdfIronPDF
GemBox.PdfIronPdf
GemBox.Pdf.ContentIronPdf (content is HTML)
GemBox.Pdf.SecurityIronPdf (SecuritySettings)
GemBox.Pdf.FormsIronPdf.Forms

Core Class Mapping

GemBox.PdfIronPDFDescription
PdfDocumentPdfDocumentMain PDF document class
PdfPagePdfDocument.Pages[i]Page representation
PdfContentN/A (use HTML)Page content
PdfFormattedTextN/A (use HTML)Formatted text
PdfPointN/A (use CSS positioning)Coordinate positioning
ComponentInfo.SetLicense()IronPdf.License.LicenseKeyLicense management

Document Operations

GemBox.PdfIronPDF
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.PdfIronPDF
document.Pages.Add()Create via HTML rendering
document.Pages.Countpdf.PageCount
document.Pages[index]pdf.Pages[index]
document.Pages.AddClone(pages)PdfDocument.Merge()

Text and Content Operations

GemBox.PdfIronPDF
new PdfFormattedText()HTML string
formattedText.Append(text)Include in HTML
formattedText.AppendLine(text)Include in HTML
formattedText.FontSize = 12CSS 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");
    }
}

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");
    }
}

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");
        }
    }
}

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");
    }
}

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");
        }
    }
}

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");
    }
}

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");
}

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>
                <!-- Add hundreds or thousands of rows - no limit! -->
            </tbody>
        </table>
    </body>
    </html>";

var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderHtmlAsPdf(html);
pdf.SaveAs("products.pdf");
C#

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>
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];

Security Settings

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

// IronPDF
pdf.SecuritySettings.UserPassword = "userPassword";
pdf.SecuritySettings.OwnerPassword = "ownerPassword";

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);

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);

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");

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");

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 note: GemBox.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

Related Articles

Key in blue circle

Get your free 30-day Trial Key instantly.

Your trial license will be sent to your email address

No limitations. 100% unlocked. No credit card.

bullet_checkedNo credit card or account creation requiredNo limitations. 100% unlocked. No credit card.
  • Logo Aetna
  • Logo NASA
  • Logo GE
  • Logo Porsche
  • Logo USDA
  • Logo Qatar
Join Millions of Engineers who’ve tried IronPDF
Book your free Live Demo
Booking Badge

Trusted by Millions of Engineers Worldwide

Iron Software's customer logos
Get Your No-Obligation Consult
Complete the form below or email sales@ironsoftware.com
Your details will always be kept confidential.
Trusted by Millions of Engineers Worldwide
Iron Software's customer logos
Get your free 30-day Trial Key instantly.
No credit card or account creation required