Skip to footer content
MIGRATION GUIDES

How to Migrate from pdforge to IronPDF in C#

Why Migrate from pdforge to IronPDF

Understanding pdforge

pdforge is a cloud-based PDF generation API, offering a straightforward way to produce PDF files by integrating with your application through API calls. By offloading the task of PDF creation to an external API, developers can simplify the development process. However, pdforge presents drawbacks such as external dependencies, limited customization options, and ongoing subscription costs that developers should be aware of.

The Cloud API Dependency Problem

pdforge processes all documents on external cloud servers. This architecture creates significant concerns for production applications:

  1. External Server Processing: Every PDF you generate requires sending your HTML/data to pdforge's servers—your documents leave your infrastructure.

  2. Privacy & Compliance Risks: Sensitive data travels over the internet to third-party servers. When using pdforge, developers need to accommodate security concerns related to data being sent to an external API. If the PDF content includes sensitive information, this could be a critical consideration.

  3. Ongoing Subscription Costs: Monthly fees accumulate indefinitely with no asset ownership. pdforge's SaaS model introduces continuous operational expenditure which can accumulate over time.

  4. Internet Dependency: No PDF generation when network is unavailable.

  5. Rate Limits: API usage caps can throttle high-volume applications.

  6. Network Latency: Round-trip time adds seconds to every PDF generation.

pdforge vs IronPDF Comparison

FeaturepdforgeIronPDF
Deployment TypeCloud-based APILocal library
DependenciesRequires internet and API authenticationNo external dependencies
CustomizationLimited control over PDF generationFull control over customization
Cost StructureOngoing subscriptionOne-time purchase option
SecurityPotential concerns with data sent over the webKeeps data processing entirely within the local environment
Setup ComplexityEasier initial setup due to external handlingRequires more initial setup and configuration

IronPDF differentiates itself by providing a fully local library, granting developers complete control over the PDF creation process. This is particularly advantageous for applications where internal handling of files is preferred, or where external API calls introduce security concerns. IronPDF processes everything locally, minimizing such risks.

For teams planning .NET 10 and C# 14 adoption through 2025 and 2026, IronPDF provides a local processing foundation that eliminates cloud dependency while adding comprehensive PDF manipulation capabilities.


Before You Start

Prerequisites

  1. .NET Environment: .NET Framework 4.6.2+ or .NET Core 3.1+ / .NET 5/6/7/8/9+
  2. NuGet Access: Ability to install NuGet packages
  3. IronPDF License: Obtain your license key from ironpdf.com

NuGet Package Changes

# Remove pdforge packages
dotnet remove package pdforge
dotnet remove package PdfForge

# Install IronPDF
dotnet add package IronPdf
# Remove pdforge packages
dotnet remove package pdforge
dotnet remove package PdfForge

# Install IronPDF
dotnet add package IronPdf
SHELL

License Configuration

// Add at application startup (Program.cs or Startup.cs)
IronPdf.License.LicenseKey = "YOUR-LICENSE-KEY";
// Add at application startup (Program.cs or Startup.cs)
IronPdf.License.LicenseKey = "YOUR-LICENSE-KEY";
$vbLabelText   $csharpLabel

Identify pdforge Usage

# Find pdforge usage
grep -r "PdForge\|PdfClient\|HtmlToPdfRequest\|HtmlToPdfConverter" --include="*.cs" .

# Find placeholder patterns to migrate
grep -r "{totalPages}" --include="*.cs" .
# Find pdforge usage
grep -r "PdForge\|PdfClient\|HtmlToPdfRequest\|HtmlToPdfConverter" --include="*.cs" .

# Find placeholder patterns to migrate
grep -r "{totalPages}" --include="*.cs" .
SHELL

Complete API Reference

Namespace Changes

// Before: pdforge
using PdfForge;
using System.IO;

// After: IronPDF
using IronPdf;
using IronPdf.Rendering;
// Before: pdforge
using PdfForge;
using System.IO;

// After: IronPDF
using IronPdf;
using IronPdf.Rendering;
$vbLabelText   $csharpLabel

Core Class Mappings

pdforgeIronPDFNotes
HtmlToPdfConverterChromePdfRendererMain PDF generator
PdfClientChromePdfRendererAPI client equivalent
PageSize.A4PdfPaperSize.A4Paper size enum
PageOrientation.LandscapePdfPaperOrientation.LandscapeOrientation enum
Return type: byte[]PdfDocumentResult object

Method Mappings

pdforgeIronPDFNotes
converter.ConvertHtmlString(html)renderer.RenderHtmlAsPdf(html)HTML string to PDF
converter.ConvertUrl(url)renderer.RenderUrlAsPdf(url)URL to PDF
File.WriteAllBytes(path, bytes)pdf.SaveAs(path)Save to disk
Return type: byte[]pdf.BinaryDataGet raw bytes

Configuration Mappings

pdforgeIronPDF (RenderingOptions)Notes
converter.PageSize = PageSize.A4renderer.RenderingOptions.PaperSize = PdfPaperSize.A4Paper size
converter.Orientation = PageOrientation.Landscaperenderer.RenderingOptions.PaperOrientation = PdfPaperOrientation.LandscapeOrientation
Footer = "Page {page} of {totalPages}"TextFooter = new TextHeaderFooter { CenterText = "Page {page} of {total-pages}" }Footer (note placeholder change)

New Features Not Available in pdforge

IronPDF FeatureDescription
PdfDocument.Merge()Combine multiple PDFs
pdf.ExtractAllText()Extract text from PDFs
pdf.ApplyWatermark()Add watermarks
pdf.SecuritySettingsPassword protection
pdf.FormForm filling
pdf.SignWithDigitalSignature()Digital signatures

Code Migration Examples

Example 1: HTML String to PDF Conversion

Before (pdforge):

// NuGet: Install-Package PdfForge
using PdfForge;
using System.IO;

class Program
{
    static void Main()
    {
        var converter = new HtmlToPdfConverter();
        var html = "<html><body><h1>Hello World</h1></body></html>";
        var pdf = converter.ConvertHtmlString(html);
        File.WriteAllBytes("output.pdf", pdf);
    }
}
// NuGet: Install-Package PdfForge
using PdfForge;
using System.IO;

class Program
{
    static void Main()
    {
        var converter = new HtmlToPdfConverter();
        var html = "<html><body><h1>Hello World</h1></body></html>";
        var pdf = converter.ConvertHtmlString(html);
        File.WriteAllBytes("output.pdf", pdf);
    }
}
$vbLabelText   $csharpLabel

After (IronPDF):

// NuGet: Install-Package IronPdf
using IronPdf;

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

class Program
{
    static void Main()
    {
        var renderer = new ChromePdfRenderer();
        var html = "<html><body><h1>Hello World</h1></body></html>";
        var pdf = renderer.RenderHtmlAsPdf(html);
        pdf.SaveAs("output.pdf");
    }
}
$vbLabelText   $csharpLabel

The fundamental difference here is the processing model and return type. pdforge uses HtmlToPdfConverter with ConvertHtmlString() which returns a byte[] array—you must then use File.WriteAllBytes() to save the result.

IronPDF uses ChromePdfRenderer with RenderHtmlAsPdf() which returns a PdfDocument object. This object can be saved directly with SaveAs(), or you can access pdf.BinaryData if you need the raw bytes. The PdfDocument also allows manipulation (add watermarks, merge with other PDFs, add security) before saving. See the HTML to PDF documentation for comprehensive examples.

Example 2: URL to PDF Conversion

Before (pdforge):

// NuGet: Install-Package PdfForge
using PdfForge;
using System.IO;

class Program
{
    static void Main()
    {
        var converter = new HtmlToPdfConverter();
        var pdf = converter.ConvertUrl("https://example.com");
        File.WriteAllBytes("webpage.pdf", pdf);
    }
}
// NuGet: Install-Package PdfForge
using PdfForge;
using System.IO;

class Program
{
    static void Main()
    {
        var converter = new HtmlToPdfConverter();
        var pdf = converter.ConvertUrl("https://example.com");
        File.WriteAllBytes("webpage.pdf", pdf);
    }
}
$vbLabelText   $csharpLabel

After (IronPDF):

// NuGet: Install-Package IronPdf
using IronPdf;

class Program
{
    static void Main()
    {
        var renderer = new ChromePdfRenderer();
        var pdf = renderer.RenderUrlAsPdf("https://example.com");
        pdf.SaveAs("webpage.pdf");
    }
}
// NuGet: Install-Package IronPdf
using IronPdf;

class Program
{
    static void Main()
    {
        var renderer = new ChromePdfRenderer();
        var pdf = renderer.RenderUrlAsPdf("https://example.com");
        pdf.SaveAs("webpage.pdf");
    }
}
$vbLabelText   $csharpLabel

pdforge uses ConvertUrl() on the HtmlToPdfConverter class, returning bytes that you write with File.WriteAllBytes(). IronPDF uses RenderUrlAsPdf() on ChromePdfRenderer, returning a PdfDocument with the built-in SaveAs() method.

The key advantage with IronPDF is that the URL is fetched and rendered locally using a Chromium engine—no data is sent to external servers. IronPDF, being a local library, may offer better performance as there is no round-trip time involved in web requests. Learn more about URL to PDF conversion.

Example 3: HTML File to PDF with Custom Settings

Before (pdforge):

// NuGet: Install-Package PdfForge
using PdfForge;
using System.IO;

class Program
{
    static void Main()
    {
        var converter = new HtmlToPdfConverter();
        converter.PageSize = PageSize.A4;
        converter.Orientation = PageOrientation.Landscape;
        var htmlContent = File.ReadAllText("input.html");
        var pdf = converter.ConvertHtmlString(htmlContent);
        File.WriteAllBytes("output.pdf", pdf);
    }
}
// NuGet: Install-Package PdfForge
using PdfForge;
using System.IO;

class Program
{
    static void Main()
    {
        var converter = new HtmlToPdfConverter();
        converter.PageSize = PageSize.A4;
        converter.Orientation = PageOrientation.Landscape;
        var htmlContent = File.ReadAllText("input.html");
        var pdf = converter.ConvertHtmlString(htmlContent);
        File.WriteAllBytes("output.pdf", pdf);
    }
}
$vbLabelText   $csharpLabel

After (IronPDF):

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

class Program
{
    static void Main()
    {
        var renderer = new ChromePdfRenderer();
        renderer.RenderingOptions.PaperSize = PdfPaperSize.A4;
        renderer.RenderingOptions.PaperOrientation = PdfPaperOrientation.Landscape;
        var htmlContent = System.IO.File.ReadAllText("input.html");
        var pdf = renderer.RenderHtmlAsPdf(htmlContent);
        pdf.SaveAs("output.pdf");
    }
}
// NuGet: Install-Package IronPdf
using IronPdf;
using IronPdf.Rendering;

class Program
{
    static void Main()
    {
        var renderer = new ChromePdfRenderer();
        renderer.RenderingOptions.PaperSize = PdfPaperSize.A4;
        renderer.RenderingOptions.PaperOrientation = PdfPaperOrientation.Landscape;
        var htmlContent = System.IO.File.ReadAllText("input.html");
        var pdf = renderer.RenderHtmlAsPdf(htmlContent);
        pdf.SaveAs("output.pdf");
    }
}
$vbLabelText   $csharpLabel

This example shows the configuration pattern difference. pdforge sets properties directly on the converter object (converter.PageSize = PageSize.A4, converter.Orientation = PageOrientation.Landscape).

IronPDF uses the RenderingOptions property with strongly-typed enums: renderer.RenderingOptions.PaperSize = PdfPaperSize.A4 and renderer.RenderingOptions.PaperOrientation = PdfPaperOrientation.Landscape. This provides IntelliSense support and compile-time type safety. Note that IronPDF requires importing IronPdf.Rendering namespace for the paper size and orientation enums. See the tutorials for more configuration examples.


Critical Migration Notes

Return Type Change

pdforge returns byte[]; IronPDF returns PdfDocument:

// pdforge: Returns byte[]
byte[] pdfBytes = converter.ConvertHtmlString(html);
File.WriteAllBytes("output.pdf", pdfBytes);

// IronPDF: Returns PdfDocument
var pdf = renderer.RenderHtmlAsPdf(html);
pdf.SaveAs("output.pdf");           // Direct save
byte[] bytes = pdf.BinaryData;      // Get bytes if needed
// pdforge: Returns byte[]
byte[] pdfBytes = converter.ConvertHtmlString(html);
File.WriteAllBytes("output.pdf", pdfBytes);

// IronPDF: Returns PdfDocument
var pdf = renderer.RenderHtmlAsPdf(html);
pdf.SaveAs("output.pdf");           // Direct save
byte[] bytes = pdf.BinaryData;      // Get bytes if needed
$vbLabelText   $csharpLabel

Converter Class Change

// pdforge: HtmlToPdfConverter
var converter = new HtmlToPdfConverter();

// IronPDF: ChromePdfRenderer
var renderer = new ChromePdfRenderer();
// pdforge: HtmlToPdfConverter
var converter = new HtmlToPdfConverter();

// IronPDF: ChromePdfRenderer
var renderer = new ChromePdfRenderer();
$vbLabelText   $csharpLabel

Method Name Changes

// pdforge methods
converter.ConvertHtmlString(html)
converter.ConvertUrl(url)

// IronPDF methods
renderer.RenderHtmlAsPdf(html)
renderer.RenderUrlAsPdf(url)
// pdforge methods
converter.ConvertHtmlString(html)
converter.ConvertUrl(url)

// IronPDF methods
renderer.RenderHtmlAsPdf(html)
renderer.RenderUrlAsPdf(url)
$vbLabelText   $csharpLabel

Save Method Change

// pdforge: Manual file write
File.WriteAllBytes("output.pdf", pdfBytes);

// IronPDF: Built-in save method
pdf.SaveAs("output.pdf");
// pdforge: Manual file write
File.WriteAllBytes("output.pdf", pdfBytes);

// IronPDF: Built-in save method
pdf.SaveAs("output.pdf");
$vbLabelText   $csharpLabel

Configuration Location Change

pdforge uses properties on the converter; IronPDF uses RenderingOptions:

// pdforge: Properties on converter
converter.PageSize = PageSize.A4;
converter.Orientation = PageOrientation.Landscape;

// IronPDF: Properties on RenderingOptions
renderer.RenderingOptions.PaperSize = PdfPaperSize.A4;
renderer.RenderingOptions.PaperOrientation = PdfPaperOrientation.Landscape;
// pdforge: Properties on converter
converter.PageSize = PageSize.A4;
converter.Orientation = PageOrientation.Landscape;

// IronPDF: Properties on RenderingOptions
renderer.RenderingOptions.PaperSize = PdfPaperSize.A4;
renderer.RenderingOptions.PaperOrientation = PdfPaperOrientation.Landscape;
$vbLabelText   $csharpLabel

If you use page numbers in headers or footers, the placeholder syntax differs:

// pdforge placeholders
"Page {page} of {totalPages}"

// IronPDF placeholders
"Page {page} of {total-pages}"  // Note: hyphen in total-pages
// pdforge placeholders
"Page {page} of {totalPages}"

// IronPDF placeholders
"Page {page} of {total-pages}"  // Note: hyphen in total-pages
$vbLabelText   $csharpLabel

New Capabilities After Migration

After migrating to IronPDF, you gain capabilities that pdforge cannot provide:

PDF Merging

var pdf1 = PdfDocument.FromFile("document1.pdf");
var pdf2 = PdfDocument.FromFile("document2.pdf");
var merged = PdfDocument.Merge(pdf1, pdf2);
merged.SaveAs("merged.pdf");
var pdf1 = PdfDocument.FromFile("document1.pdf");
var pdf2 = PdfDocument.FromFile("document2.pdf");
var merged = PdfDocument.Merge(pdf1, pdf2);
merged.SaveAs("merged.pdf");
$vbLabelText   $csharpLabel

Text Extraction

var pdf = PdfDocument.FromFile("document.pdf");
string allText = pdf.ExtractAllText();
var pdf = PdfDocument.FromFile("document.pdf");
string allText = pdf.ExtractAllText();
$vbLabelText   $csharpLabel

Watermarks

pdf.ApplyWatermark("<h2 style='color:red;'>CONFIDENTIAL</h2>");
pdf.ApplyWatermark("<h2 style='color:red;'>CONFIDENTIAL</h2>");
$vbLabelText   $csharpLabel

Password Protection

pdf.SecuritySettings.UserPassword = "userpassword";
pdf.SecuritySettings.OwnerPassword = "ownerpassword";
pdf.SecuritySettings.UserPassword = "userpassword";
pdf.SecuritySettings.OwnerPassword = "ownerpassword";
$vbLabelText   $csharpLabel

Feature Comparison Summary

FeaturepdforgeIronPDF
HTML to PDF
URL to PDF
Page Settings
Offline Capable
Local Processing
Merge PDFs
Split PDFs
Extract Text
Watermarks
Form Filling
Digital Signatures
Password Protection
No Rate Limits
One-Time License

Migration Checklist

Pre-Migration

  • Inventory all pdforge API calls in codebase
  • Document current configuration options used (page size, orientation)
  • Identify header/footer placeholders to update ({totalPages}{total-pages})
  • Plan IronPDF license key storage (environment variables recommended)
  • Test with IronPDF trial license first

Package Changes

  • Remove pdforge NuGet package
  • Remove PdfForge NuGet package
  • Install IronPdf NuGet package: dotnet add package IronPdf

Code Changes

  • Update all namespace imports (using PdfForge;using IronPdf;)
  • Add using IronPdf.Rendering; for paper size and orientation enums
  • Replace HtmlToPdfConverter with ChromePdfRenderer
  • Replace ConvertHtmlString() with RenderHtmlAsPdf()
  • Replace ConvertUrl() with RenderUrlAsPdf()
  • Replace File.WriteAllBytes() with pdf.SaveAs()
  • Move PageSize property to RenderingOptions.PaperSize
  • Move Orientation property to RenderingOptions.PaperOrientation
  • Update enum names (PageSize.A4PdfPaperSize.A4)
  • Update enum names (PageOrientation.LandscapePdfPaperOrientation.Landscape)
  • Update placeholder syntax in headers/footers

Post-Migration

  • Test PDF output quality matches expectations
  • Verify offline operation works
  • Remove API credentials from configuration
  • Add new capabilities (merging, watermarks, security) as needed

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