Skip to footer content
MIGRATION GUIDES

How to Migrate from PDFFilePrint to IronPDF in C#

Migrating from PDFFilePrint to IronPDF moves your .NET PDF workflow from a printing-focused utility with limited capabilities to a comprehensive PDF library that handles creation, manipulation, and printing in a single unified API. This guide provides a complete, step-by-step migration path that eliminates command-line dependencies while adding PDF generation and manipulation capabilities that PDFFilePrint cannot provide.

Why Migrate from PDFFilePrint to IronPDF

Understanding PDFFilePrint

PDFFilePrint is a practical tool specifically designed for printing PDF files from C# applications. While it serves well for targeted PDF printing tasks, its functionality is limited to one aspect of document handling. PDFFilePrint's primary allure lies in its simplicity—a singular focus on providing a printing experience for PDF files. However, this narrow focus creates significant limitations for comprehensive document management systems.

Critical PDFFilePrint Limitations

  1. Printing-Only Focus: PDFFilePrint's functionality is limited to printing. It lacks features for creating or modifying PDF files, which is limiting for more comprehensive document management systems.

  2. Command-Line Dependency: Often relying on command-line operations with Process.Start() calls, PDFFilePrint may not meet the needs for seamless integration into applications that require more robust APIs.

  3. Windows-Only: As it relies heavily on Windows printing systems, it may not be the best choice for environments using other operating systems.

  4. No .NET Integration: No native API, no NuGet package, and no IntelliSense support in some usage patterns.

  5. External Process Management: Must handle process lifecycle, exit codes, and error parsing from stdout/stderr.

  6. Limited Error Handling: Detecting errors requires parsing standard output and error streams rather than native exceptions.

  7. Deployment Complexity: Must bundle PDFFilePrint.exe with application in command-line usage scenarios.

  8. No PDF Generation: Cannot create PDFs—only print existing ones in its command-line mode.

PDFFilePrint vs IronPDF Comparison

AspectPDFFilePrintIronPDF
Primary FocusPDF PrintingComprehensive PDF API
TypeCommand-line utility / Basic libraryNative .NET library
IntegrationProcess.Start() / Basic APIDirect API calls
PDF Printing
PDF CreationLimited✓ (HTML, URL, images)
PDF Manipulation✓ (merge, split, edit)
Cross-PlatformWindows onlyWindows, Linux, macOS
Error HandlingParse stdout/stderrNative exceptions
IntelliSenseLimitedFull support
NuGet PackageLimited
DocumentationBasicExtensive

For teams planning .NET 10 and C# 14 adoption through 2025 and 2026, IronPDF provides a comprehensive foundation with cross-platform support and active development, addressing PDFFilePrint's architectural limitations.


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 PDFFilePrint package (if installed via NuGet)
dotnet remove package PDFFilePrint

# If using command-line PDFFilePrint.exe, remove from deployment
# Delete bundled PDFFilePrint.exe from your project

# Install IronPDF
dotnet add package IronPdf
# Remove PDFFilePrint package (if installed via NuGet)
dotnet remove package PDFFilePrint

# If using command-line PDFFilePrint.exe, remove from deployment
# Delete bundled PDFFilePrint.exe from your project

# 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 PDFFilePrint Usage

# Find PDFFilePrint references
grep -r "PDFFilePrint\|PDFFile\|CreateFromHtml\|CreateFromUrl" --include="*.cs" .

# Find command-line execution patterns
grep -r "ProcessStartInfo.*pdf\|Process.Start.*print" --include="*.cs" .

# Find batch scripts
find . -name "*.bat" -o -name "*.cmd" | xargs grep -l "PDFFilePrint"
# Find PDFFilePrint references
grep -r "PDFFilePrint\|PDFFile\|CreateFromHtml\|CreateFromUrl" --include="*.cs" .

# Find command-line execution patterns
grep -r "ProcessStartInfo.*pdf\|Process.Start.*print" --include="*.cs" .

# Find batch scripts
find . -name "*.bat" -o -name "*.cmd" | xargs grep -l "PDFFilePrint"
SHELL

Complete API Reference

Namespace Changes

// PDFFilePrint
using PDFFilePrint;
using System.Diagnostics; // For command-line usage

// IronPDF
using IronPdf;
using IronPdf.Printing;
// PDFFilePrint
using PDFFilePrint;
using System.Diagnostics; // For command-line usage

// IronPDF
using IronPdf;
using IronPdf.Printing;
$vbLabelText   $csharpLabel

Core Class Mappings

PDFFilePrintIronPDFNotes
new PDFFile()new ChromePdfRenderer()For PDF creation
new PDFFile()PdfDocument.FromFile()For loading existing PDFs
PDFFilePdfDocumentDocument object

PDF Generation Method Mappings

PDFFilePrintIronPDFNotes
pdf.CreateFromHtml(html)renderer.RenderHtmlAsPdf(html)HTML to PDF
pdf.CreateFromUrl(url)renderer.RenderUrlAsPdf(url)URL to PDF
pdf.SaveToFile(path)pdf.SaveAs(path)Save to file

PDF Loading and Printing Mappings

PDFFilePrintIronPDFNotes
pdf.LoadFromFile(path)PdfDocument.FromFile(path)Load existing PDF
pdf.Print(printerName)pdf.Print(printerName)Print to specific printer
pdf.Print("Default Printer")pdf.Print()Print to default

Print Settings Mappings (Command-Line to API)

PDFFilePrint FlagIronPDF PrintSettings PropertyNotes
-printer "Name"PrinterNamestring
-copies NNumberOfCopiesint
-silentShowPrintDialog = falseInverted logic
-pages "1-5"FromPage, ToPageint
-orientation landscapePaperOrientationPdfPrintOrientation
-duplexDuplexDuplex enum
-collateCollatebool

New Capabilities Not in PDFFilePrint

IronPDF FeatureDescription
PdfDocument.Merge()Combine multiple PDFs
pdf.CopyPages()Extract specific pages
pdf.ApplyWatermark()Add watermarks
pdf.SecuritySettingsPassword protection
pdf.ExtractAllText()Extract text content
pdf.RasterizeToImageFiles()Convert to images
pdf.SignWithDigitalSignature()Digital signatures

Code Migration Examples

Example 1: HTML to PDF Conversion

Before (PDFFilePrint):

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

class Program
{
    static void Main()
    {
        var pdf = new PDFFile();
        string htmlContent = "<html><body><h1>Hello World</h1></body></html>";
        pdf.CreateFromHtml(htmlContent);
        pdf.SaveToFile("output.pdf");
    }
}
// NuGet: Install-Package PDFFilePrint
using System;
using PDFFilePrint;

class Program
{
    static void Main()
    {
        var pdf = new PDFFile();
        string htmlContent = "<html><body><h1>Hello World</h1></body></html>";
        pdf.CreateFromHtml(htmlContent);
        pdf.SaveToFile("output.pdf");
    }
}
$vbLabelText   $csharpLabel

After (IronPDF):

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

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

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

The fundamental difference here is the API pattern. PDFFilePrint uses a single PDFFile class with CreateFromHtml() and SaveToFile() methods. IronPDF separates rendering from the document object—ChromePdfRenderer handles the HTML-to-PDF conversion and returns a PdfDocument object that you then save with SaveAs().

This separation provides significant advantages: you can configure rendering options on the renderer before conversion, and the returned PdfDocument can be manipulated (add watermarks, merge with other PDFs, add security) before saving. See the HTML to PDF documentation for additional rendering options.

Example 2: URL to PDF Conversion

Before (PDFFilePrint):

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

class Program
{
    static void Main()
    {
        var pdf = new PDFFile();
        pdf.CreateFromUrl("https://www.example.com");
        pdf.SaveToFile("webpage.pdf");
    }
}
// NuGet: Install-Package PDFFilePrint
using System;
using PDFFilePrint;

class Program
{
    static void Main()
    {
        var pdf = new PDFFile();
        pdf.CreateFromUrl("https://www.example.com");
        pdf.SaveToFile("webpage.pdf");
    }
}
$vbLabelText   $csharpLabel

After (IronPDF):

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

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

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

PDFFilePrint uses CreateFromUrl() on the same PDFFile class. IronPDF uses the dedicated RenderUrlAsPdf() method on ChromePdfRenderer, which leverages a modern Chromium engine for accurate rendering of complex CSS3, JavaScript, and modern web features. The rendering quality is predictable and matches what you see in Chrome browser. Learn more about URL to PDF conversion.

Example 3: PDF Printing

Before (PDFFilePrint):

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

class Program
{
    static void Main()
    {
        var pdf = new PDFFile();
        pdf.LoadFromFile("document.pdf");
        pdf.Print("Default Printer");
        Console.WriteLine("PDF sent to printer");
    }
}
// NuGet: Install-Package PDFFilePrint
using System;
using PDFFilePrint;

class Program
{
    static void Main()
    {
        var pdf = new PDFFile();
        pdf.LoadFromFile("document.pdf");
        pdf.Print("Default Printer");
        Console.WriteLine("PDF sent to printer");
    }
}
$vbLabelText   $csharpLabel

After (IronPDF):

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

class Program
{
    static void Main()
    {
        var pdf = PdfDocument.FromFile("document.pdf");
        pdf.Print();
        Console.WriteLine("PDF sent to printer");
    }
}
// NuGet: Install-Package IronPdf
using IronPdf;
using System;

class Program
{
    static void Main()
    {
        var pdf = PdfDocument.FromFile("document.pdf");
        pdf.Print();
        Console.WriteLine("PDF sent to printer");
    }
}
$vbLabelText   $csharpLabel

This example shows a fundamental architectural difference in PDF loading and printing. PDFFilePrint uses new PDFFile() followed by LoadFromFile(), then Print(printerName). IronPDF uses the static factory method PdfDocument.FromFile() to load directly, then Print() which uses the default printer (or you can pass a printer name).

The key migration changes:

  • new PDFFile() + LoadFromFile(path)PdfDocument.FromFile(path)
  • Print("Default Printer")Print() (default printer is automatic)

For advanced print settings, IronPDF provides a PrintSettings class. See the printing documentation for advanced options.


Advanced Print Settings Migration

For applications using PDFFilePrint's command-line flags, here's how to migrate to IronPDF's PrintSettings:

// PDFFilePrint command-line approach:
// PDFFilePrint.exe -silent -copies 3 -printer "HP LaserJet" -pages "1-5" "document.pdf"

// IronPDF equivalent:
using IronPdf;

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

var settings = new PrintSettings
{
    ShowPrintDialog = false,    // -silent
    NumberOfCopies = 3,         // -copies 3
    PrinterName = "HP LaserJet", // -printer "HP LaserJet"
    FromPage = 1,               // -pages "1-5"
    ToPage = 5
};

pdf.Print(settings);
// PDFFilePrint command-line approach:
// PDFFilePrint.exe -silent -copies 3 -printer "HP LaserJet" -pages "1-5" "document.pdf"

// IronPDF equivalent:
using IronPdf;

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

var settings = new PrintSettings
{
    ShowPrintDialog = false,    // -silent
    NumberOfCopies = 3,         // -copies 3
    PrinterName = "HP LaserJet", // -printer "HP LaserJet"
    FromPage = 1,               // -pages "1-5"
    ToPage = 5
};

pdf.Print(settings);
$vbLabelText   $csharpLabel

Silent Mode Flag Conversion

Note the inverted logic for silent printing:

// PDFFilePrint: -silent flag enables silent mode
// IronPDF: ShowPrintDialog = false (false = silent)
var settings = new PrintSettings { ShowPrintDialog = false };
// PDFFilePrint: -silent flag enables silent mode
// IronPDF: ShowPrintDialog = false (false = silent)
var settings = new PrintSettings { ShowPrintDialog = false };
$vbLabelText   $csharpLabel

New Capabilities After Migration

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

Create and Print in One Step

using IronPdf;

var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderHtmlAsPdf("<h1>Invoice #12345</h1><p>Thank you for your order.</p>");
pdf.Print("Office Printer");
using IronPdf;

var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderHtmlAsPdf("<h1>Invoice #12345</h1><p>Thank you for your order.</p>");
pdf.Print("Office Printer");
$vbLabelText   $csharpLabel

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

Watermarks

var pdf = PdfDocument.FromFile("document.pdf");
pdf.ApplyWatermark("<h1 style='color:red; opacity:0.3;'>CONFIDENTIAL</h1>");
pdf.SaveAs("watermarked.pdf");
var pdf = PdfDocument.FromFile("document.pdf");
pdf.ApplyWatermark("<h1 style='color:red; opacity:0.3;'>CONFIDENTIAL</h1>");
pdf.SaveAs("watermarked.pdf");
$vbLabelText   $csharpLabel

Password Protection

var pdf = renderer.RenderHtmlAsPdf(html);
pdf.SecuritySettings.UserPassword = "userpassword";
pdf.SecuritySettings.OwnerPassword = "ownerpassword";
pdf.SaveAs("secured.pdf");
var pdf = renderer.RenderHtmlAsPdf(html);
pdf.SecuritySettings.UserPassword = "userpassword";
pdf.SecuritySettings.OwnerPassword = "ownerpassword";
pdf.SaveAs("secured.pdf");
$vbLabelText   $csharpLabel

Text Extraction

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

Critical Migration Notes

Class Pattern Change

PDFFilePrint uses a single PDFFile class for everything; IronPDF separates concerns:

// PDFFilePrint: Single class
var pdf = new PDFFile();
pdf.CreateFromHtml(html);
pdf.SaveToFile(path);

// IronPDF: Renderer for creation, Document for manipulation
var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderHtmlAsPdf(html);
pdf.SaveAs(path);
// PDFFilePrint: Single class
var pdf = new PDFFile();
pdf.CreateFromHtml(html);
pdf.SaveToFile(path);

// IronPDF: Renderer for creation, Document for manipulation
var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderHtmlAsPdf(html);
pdf.SaveAs(path);
$vbLabelText   $csharpLabel

Method Naming Changes

// PDFFilePrint → IronPDF
CreateFromHtml() → RenderHtmlAsPdf()
CreateFromUrl() → RenderUrlAsPdf()
LoadFromFile() → PdfDocument.FromFile()
SaveToFile() → SaveAs()
Print(printerName) → Print(printerName) or Print()
// PDFFilePrint → IronPDF
CreateFromHtml() → RenderHtmlAsPdf()
CreateFromUrl() → RenderUrlAsPdf()
LoadFromFile() → PdfDocument.FromFile()
SaveToFile() → SaveAs()
Print(printerName) → Print(printerName) or Print()
$vbLabelText   $csharpLabel

Exit Code to Exception Handling

If using command-line PDFFilePrint:

// PDFFilePrint: Check process exit code
if (process.ExitCode != 0) {
    var error = process.StandardError.ReadToEnd();
    throw new Exception($"Print failed: {error}");
}

// IronPDF: Use try-catch
try {
    pdf.Print();
}
catch (Exception ex) {
    // Handle error with full exception details
}
// PDFFilePrint: Check process exit code
if (process.ExitCode != 0) {
    var error = process.StandardError.ReadToEnd();
    throw new Exception($"Print failed: {error}");
}

// IronPDF: Use try-catch
try {
    pdf.Print();
}
catch (Exception ex) {
    // Handle error with full exception details
}
$vbLabelText   $csharpLabel

Remove External Dependencies

If using command-line PDFFilePrint, remove the bundled executable:

// Before: Required external executable
private readonly string _pdfFilePrintPath = @"C:\tools\PDFFilePrint.exe";

// After: No external dependencies
// IronPDF is fully self-contained via NuGet
// Before: Required external executable
private readonly string _pdfFilePrintPath = @"C:\tools\PDFFilePrint.exe";

// After: No external dependencies
// IronPDF is fully self-contained via NuGet
$vbLabelText   $csharpLabel

Feature Comparison Summary

FeaturePDFFilePrintIronPDF
Basic printing
Silent printing
Multiple copies
Page range
DuplexVaries
Create from HTMLLimited
Create from URLLimited
Merge PDFs
Split PDFs
Add watermarks
Extract text
Password protection
Digital signatures
Cross-platform
Native .NET APILimited

Migration Checklist

Pre-Migration

  • Locate all PDFFilePrint references in codebase
  • Document current methods used (CreateFromHtml, CreateFromUrl, Print, etc.)
  • Identify printer names used across environments
  • List any command-line arguments if using Process.Start pattern
  • Identify opportunities for new features (merging, watermarks, security)
  • Obtain IronPDF license key

Package Changes

  • Remove PDFFilePrint NuGet package
  • Remove bundled PDFFilePrint.exe from deployment (if applicable)
  • Install IronPdf NuGet package: dotnet add package IronPdf
  • Update namespace imports

Code Changes

  • Add license key configuration at startup
  • Replace new PDFFile() + CreateFromHtml() with ChromePdfRenderer.RenderHtmlAsPdf()
  • Replace new PDFFile() + CreateFromUrl() with ChromePdfRenderer.RenderUrlAsPdf()
  • Replace LoadFromFile() with PdfDocument.FromFile()
  • Replace SaveToFile() with SaveAs()
  • Update Print() calls as needed
  • Replace exit code checks with exception handling (if applicable)

Post-Migration

  • Remove PDFFilePrint.exe from source control
  • Update build scripts to remove PDFFilePrint copying
  • Test printing on all target printers
  • Test cross-platform if applicable
  • Add new features (watermarks, security) as needed
  • Update documentation

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