IRONSOFTWAREHOME
MIGRATION GUIDES

How to Migrate from ComPDFKit to IronPDF in C#

Curtis Chau
Curtis Chau
Updated: August 1, 2026

While ComPDFKit offers solid PDF manipulation features, several factors drive development teams to consider more established alternatives.

Market Maturity and Ecosystem Comparison

ComPDFKit faces challenges common to newer market entrants: documentation gaps, a smaller community, and limited Stack Overflow coverage. IronPDF's decade of refinement provides the stability and resources enterprise projects require.

AspectComPDFKitIronPDF
HTML-to-PDFRequires manual HTML parsingNative Chromium rendering
Market MaturityNewer entrant10+ years, battle-tested
Community SizeSmaller, limited Stack OverflowLarge, active community
DocumentationSome gapsExtensive tutorials & guides
DownloadsGrowing10+ million NuGet downloads
API StyleC++ influenced, verboseModern .NET fluent API
Memory ManagementManual Release() callsAutomatic GC handling

Feature Parity

Both libraries support comprehensive PDF functionality:

FeatureComPDFKitIronPDF
HTML to PDFBasic/Manual✅ Native Chromium
URL to PDFManual implementation✅ Built-in
Create PDF from scratch
PDF editing
Text extraction
Merge/Split
Digital signatures
Form filling
Watermarks
Cross-platformWindows, Linux, macOSWindows, Linux, macOS

Key Migration Benefits

  1. Superior HTML Rendering: IronPDF's Chromium engine handles modern CSS3, JavaScript, and responsive layouts natively
  2. Mature Ecosystem: 10+ years of refinement, extensive documentation, and proven stability
  3. Simpler API: Less boilerplate code, no manual memory management with Release() calls
  4. Better .NET Integration: Native async/await, LINQ support, fluent interfaces
  5. Extensive Resources: Thousands of Stack Overflow answers and community examples

Pre-Migration Preparation

Prerequisites

Ensure your environment meets these requirements:

  • .NET Framework 4.6.2+ or .NET Core 3.1 / .NET 5-9
  • Visual Studio 2019+ or VS Code with C# extension
  • NuGet Package Manager access
  • IronPDF license key (free trial available at ironpdf.com)

Audit ComPDFKit Usage

Run these commands in your solution directory to identify all ComPDFKit references:

# Find all ComPDFKit usages in your codebase
grep -r "using ComPDFKit" --include="*.cs" .
grep -r "CPDFDocument\|CPDFPage\|CPDFAnnotation" --include="*.cs" .

# Find NuGet package references
grep -r "ComPDFKit" --include="*.csproj" .
SHELL

Breaking Changes to Anticipate

ChangeComPDFKitIronPDFImpact
Document loadingCPDFDocument.InitWithFilePath()PdfDocument.FromFile()Method name change
Savingdocument.WriteToFilePath()pdf.SaveAs()Method name change
Memory cleanupdocument.Release() requiredAutomatic (GC)Remove manual cleanup
Page accessdocument.PageAtIndex(i)pdf.Pages[i]Array-style access
Page indexing0-based0-basedNo change needed
HTML renderingManual implementationRenderHtmlAsPdf()Major simplification
Text extractiontextPage.GetText()pdf.ExtractAllText()Simplified API

Step-by-Step Migration Process

Step 1: Update NuGet Packages

Remove ComPDFKit packages and install IronPDF:

# Remove ComPDFKit packages
dotnet remove package ComPDFKit.NetCore
dotnet remove package ComPDFKit.NetFramework

# Install IronPDF
dotnet add package IronPdf
SHELL

Step 2: Update Namespace References

Replace ComPDFKit namespaces with IronPDF:

// Remove these
using ComPDFKit.PDFDocument;
using ComPDFKit.PDFPage;
using ComPDFKit.PDFAnnotation;
using ComPDFKit.Import;

// Add this
using IronPdf;

Step 3: Configure License

// Add at application startup (Program.cs or Global.asax)
IronPdf.License.LicenseKey = "YOUR-LICENSE-KEY";

Complete API Migration Reference

Document Operations

TaskComPDFKitIronPDF
Create empty documentCPDFDocument.CreateDocument()new PdfDocument()
Load from fileCPDFDocument.InitWithFilePath(path)PdfDocument.FromFile(path)
Load from streamCPDFDocument.InitWithStream(stream)PdfDocument.FromStream(stream)
Save to filedocument.WriteToFilePath(path)pdf.SaveAs(path)
Get page countdocument.PageCountpdf.PageCount
Release/Disposedocument.Release()Not required

HTML to PDF Conversion

TaskComPDFKitIronPDF
HTML string to PDFManual implementation requiredrenderer.RenderHtmlAsPdf(html)
HTML file to PDFManual implementation requiredrenderer.RenderHtmlFileAsPdf(path)
URL to PDFManual implementation requiredrenderer.RenderUrlAsPdf(url)
Set page sizeVia page creation parametersrenderer.RenderingOptions.PaperSize
Set marginsVia editor configurationrenderer.RenderingOptions.MarginTop etc.

Merge and Split Operations

TaskComPDFKitIronPDF
Merge documentsdoc1.ImportPagesAtIndex(doc2, range, index)PdfDocument.Merge(pdf1, pdf2)
Split documentExtract pages to new documentpdf.CopyPages(start, end)

Code Migration Examples

HTML to PDF Conversion

The most significant difference between ComPDFKit and IronPDF is HTML rendering. ComPDFKit requires manual text placement, while IronPDF renders HTML natively with its Chromium engine.

ComPDFKit Implementation:

// NuGet: Install-Package ComPDFKit.NetCore
using ComPDFKit.PDFDocument;
using System;

class Program
{
    static void Main()
    {
        // ComPDFKit's .NET SDK has no native HTML-to-PDF rendering.
        // The closest equivalent is to create a blank document and lay
        // out primitives manually, or call ComPDFKit's separate cloud
        // Conversion API (a different SKU).
        var document = CPDFDocument.CreateDocument();
        document.InsertPage(0, 595, 842, string.Empty);

        document.WriteToFilePath("output.pdf");
        document.Release();
    }
}

IronPDF Implementation:

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

class Program
{
    static void Main()
    {
        var renderer = new ChromePdfRenderer();
        var pdf = renderer.RenderHtmlAsPdf("<h1>Hello World</h1><p>This is HTML content.</p>");
        pdf.SaveAs("output.pdf");
    }
}

IronPDF's ChromePdfRenderer eliminates the need for manual text positioning and editor management. For more HTML conversion options, see the HTML to PDF documentation.

Merging Multiple PDFs

ComPDFKit Implementation:

// NuGet: Install-Package ComPDFKit.NetCore
using ComPDFKit.PDFDocument;
using ComPDFKit.Import;
using System;

class Program
{
    static void Main()
    {
        var document1 = CPDFDocument.InitWithFilePath("file1.pdf");
        var document2 = CPDFDocument.InitWithFilePath("file2.pdf");
        
        // Import pages from document2 into document1
        document1.ImportPagesAtIndex(document2, "0-" + (document2.PageCount - 1), document1.PageCount);
        
        document1.WriteToFilePath("merged.pdf");
        document1.Release();
        document2.Release();
    }
}

IronPDF Implementation:

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

class Program
{
    static void Main()
    {
        var pdf1 = PdfDocument.FromFile("file1.pdf");
        var pdf2 = PdfDocument.FromFile("file2.pdf");
        
        var merged = PdfDocument.Merge(new List<PdfDocument> { pdf1, pdf2 });
        merged.SaveAs("merged.pdf");
    }
}

IronPDF's static Merge method eliminates the verbose ImportPagesAtIndex pattern with page range strings. For more options, see the PDF merging documentation.

Adding Watermarks

Watermarking shows the difference between ComPDFKit's property-driven CPDFWatermark configuration and IronPDF's HTML-based styling.

ComPDFKit Implementation:

// NuGet: Install-Package ComPDFKit.NetCore
using ComPDFKit.PDFDocument;
using ComPDFKit.PDFWatermark;
using System;

class Program
{
    static void Main()
    {
        var document = CPDFDocument.InitWithFilePath("input.pdf");

        CPDFWatermark watermark = document.InitWatermark(
            C_Watermark_Type.WATERMARK_TYPE_TEXT);
        watermark.SetText("CONFIDENTIAL");
        watermark.SetFontName("Helvetica");
        watermark.SetFontSize(48);
        watermark.SetTextRGBColor(255, 0, 0);
        watermark.SetRotation(45);
        watermark.SetOpacity(76); // 0..255
        watermark.SetVertalign(C_Watermark_Vertalign.WATERMARK_VERTALIGN_CENTER);
        watermark.SetHorizalign(C_Watermark_Horizalign.WATERMARK_HORIZALIGN_CENTER);
        watermark.SetPages($"0-{document.PageCount - 1}");
        watermark.SetFront(true);
        watermark.CreateWatermark();

        document.WriteToFilePath("watermarked.pdf");
        document.Release();
    }
}

IronPDF Implementation:

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

class Program
{
    static void Main()
    {
        var pdf = PdfDocument.FromFile("input.pdf");
        
        pdf.ApplyWatermark("<h1 style='color:rgba(255,0,0,0.3);'>CONFIDENTIAL</h1>",
            rotation: 45,
            verticalAlignment: VerticalAlignment.Middle,
            horizontalAlignment: HorizontalAlignment.Center);
        
        pdf.SaveAs("watermarked.pdf");
    }
}

IronPDF reduces the multi-step CPDFWatermark configuration to a single method call with HTML/CSS styling. For more options, see the watermark documentation.

Text Extraction

ComPDFKit Implementation:

using ComPDFKit.PDFDocument;
using System.Text;

var document = CPDFDocument.InitWithFilePath("document.pdf");

// Extract text (verbose)
var allText = new StringBuilder();
for (int i = 0; i < document.PageCount; i++)
{
    var page = document.PageAtIndex(i);
    var textPage = page.GetTextPage();
    allText.AppendLine(textPage.GetText(0, textPage.CountChars()));
    textPage.Release();
    page.Release();
}

document.WriteToFilePath("output.pdf");
document.Release(); // Must remember to release!

IronPDF Implementation:

using IronPdf;

var pdf = PdfDocument.FromFile("document.pdf");

// Extract text (one-liner)
string allText = pdf.ExtractAllText();

pdf.SaveAs("output.pdf");
// No Release() needed - GC handles cleanup

IronPDF reduces multi-line text extraction with manual Release() calls to a single method. For more extraction options, see the text extraction documentation.

Password Protection

IronPDF Implementation:

using IronPdf;

var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderHtmlAsPdf("<h1>Confidential Document</h1>");

// Set security
pdf.SecuritySettings.UserPassword = "userPassword";
pdf.SecuritySettings.OwnerPassword = "ownerPassword";
pdf.SecuritySettings.AllowUserPrinting = PdfPrintSecurity.FullPrintRights;
pdf.SecuritySettings.AllowUserCopyPasteContent = false;

pdf.SaveAs("protected.pdf");

For comprehensive security options, see the encryption documentation.

Critical Migration Notes

Remove All Release() Calls

The most impactful change is removing manual memory management. ComPDFKit requires explicit Release() calls on documents, pages, and text pages. IronPDF handles this automatically through .NET garbage collection:

// ComPDFKit - manual cleanup required
document.Release();
page.Release();
textPage.Release();

// IronPDF - no equivalent needed
// GC handles cleanup automatically
C#

Native HTML Rendering

ComPDFKit requires manual text placement with editor APIs. IronPDF renders HTML/CSS natively with its Chromium engine, supporting modern CSS3, JavaScript, and responsive layouts.

Same Page Indexing

Both libraries use 0-based indexing (Pages[0] is the first page) - no changes needed for page access code.

Simplified Text Extraction

Replace the multi-line GetTextPage() + GetText() + Release() pattern with a single ExtractAllText() call.

Fluent Merge API

Replace ImportPagesAtIndex(doc2, "0-9", pageCount) with simple Merge(pdf1, pdf2).

Post-Migration Checklist

After completing the code migration, verify the following:

  • Run all unit tests to verify PDF generation works correctly
  • Compare PDF output quality (IronPDF's Chromium engine may render differently - usually better)
  • Test HTML rendering with complex CSS and JavaScript
  • Verify text extraction accuracy
  • Test form functionality
  • Performance test batch operations
  • Test in all target environments
  • Update CI/CD pipelines
  • Remove ComPDFKit license files

Additional Resources


Migrating from ComPDFKit to IronPDF eliminates manual memory management with Release() calls while providing native HTML-to-PDF rendering that ComPDFKit lacks. The transition to IronPDF's mature ecosystem delivers the documentation depth, community support, and proven stability that enterprise projects require.

Please note: ComPDFKit is a registered trademark of its respective owner. This site is not affiliated with, endorsed by, or sponsored by ComPDFKit. 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