How to Migrate from PDFPrinting.NET to IronPDF in C#
Migrating from PDFPrinting.NET to IronPDF expands your PDF capabilities from a printing-only library to a comprehensive solution that handles the complete PDF lifecycle including creation, manipulation, extraction, security, and printing. This guide provides a complete, step-by-step migration path that preserves your existing printing workflows while adding PDF generation, HTML conversion, and cross-platform support capabilities.
Why Migrate from PDFPrinting.NET to IronPDF
Understanding PDFPrinting.NET
PDFPrinting.NET stands out as a specialized solution offering unparalleled simplicity and effectiveness in silent PDF printing. Operating primarily within the Windows ecosystem, PDFPrinting.NET is a commercial library designed to cater specifically to developers who need to integrate PDF printing capabilities into their applications. As a dedicated tool focused solely on the silent and robust printing of PDFs, PDFPrinting.NET finds its niche in simplifying the often complex task of printing documents programmatically without user intervention.
One of the most significant advantages of PDFPrinting.NET is its ability to print documents silently. It bypasses the usual print dialogue windows, facilitating fully automated workflow processes, which is crucial for applications demanding minimal user interaction.
The Printing-Only Limitation
A noticeable limitation of PDFPrinting.NET is that it only addresses the printing aspect of PDF processing. It cannot create, modify, or manipulate PDF documents, restricting its utility for developers needing solutions for the complete PDF document lifecycle:
Printing Only: Cannot create, edit, or manipulate PDF documents.
Windows Only: Tied to Windows printing infrastructure—no Linux/macOS support. Reliance on the Windows printing infrastructure restricts its applicability to Windows-only environments, limiting cross-platform usability.
No PDF Generation: Cannot convert HTML, URLs, or data to PDF.
No Document Manipulation: Cannot merge, split, watermark, or secure PDFs.
No Text Extraction: Cannot read or extract content from PDFs.
- No Form Handling: Cannot fill or flatten PDF forms.
PDFPrinting.NET vs IronPDF Comparison
| Feature | PDFPrinting.NET | IronPDF |
|---|---|---|
| Primary Functionality | Silent PDF printing | Full cycle handling (create, edit, print) |
| Platform Support | Windows only | Cross-platform |
| PDF Creation/Manipulation Capability | No | Yes |
| HTML-to-PDF Conversion | No | Yes |
| Suitability for Automated Workflows | High | High |
| Additional Dependencies | Relies on Windows printers | Internal browser engine for rendering |
| Silent Printing | Yes | Yes |
| Text Extraction | Not supported | Full support |
| Licensing | Commercial | Commercial |
IronPDF presents a more comprehensive solution by addressing the complete lifecycle of PDF handling. It facilitates the creation, editing, conversion, and printing of PDF documents, offering developers a full suite of features through a unified API. Unlike PDFPrinting.NET, IronPDF can be deployed across different platforms, making it a versatile choice for applications that operate in diverse environments.
For teams planning .NET 10 and C# 14 adoption through 2025 and 2026, IronPDF provides a complete PDF solution that works across Windows, Linux, and macOS environments.
Before You Start
Prerequisites
- .NET Environment: .NET Framework 4.6.2+ or .NET Core 3.1+ / .NET 5/6/7/8/9+
- NuGet Access: Ability to install NuGet packages
- IronPDF License: Obtain your license key from ironpdf.com
NuGet Package Changes
# Remove PDFPrinting.NET
dotnet remove package PDFPrinting.NET
# Install IronPDF
dotnet add package IronPdf# Remove PDFPrinting.NET
dotnet remove package PDFPrinting.NET
# Install IronPDF
dotnet add package IronPdfLicense 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";Identify PDFPrinting.NET Usage
# Find PDFPrinting.NET usage
grep -r "PDFPrinting\|PDFPrinter" --include="*.cs" .
# Find print-related code
grep -r "\.Print(\|PrinterName\|GetPrintDocument" --include="*.cs" .# Find PDFPrinting.NET usage
grep -r "PDFPrinting\|PDFPrinter" --include="*.cs" .
# Find print-related code
grep -r "\.Print(\|PrinterName\|GetPrintDocument" --include="*.cs" .Complete API Reference
Namespace Changes
// Before: PDFPrinting.NET
using PDFPrinting.NET;
using PDFPrintingNET;
// After: IronPDF
using IronPdf;
using IronPdf.Rendering;
using IronPdf.Printing;// Before: PDFPrinting.NET
using PDFPrinting.NET;
using PDFPrintingNET;
// After: IronPDF
using IronPdf;
using IronPdf.Rendering;
using IronPdf.Printing;Core Class Mappings
| PDFPrinting.NET | IronPDF | Notes |
|---|---|---|
PDFPrinter | PdfDocument | Core PDF object |
HtmlToPdfConverter | ChromePdfRenderer | PDF generation |
WebPageToPdfConverter | ChromePdfRenderer | URL conversion |
| Print settings properties | PrintSettings | Print configuration |
Printing Method Mappings
| PDFPrinting.NET | IronPDF | Notes |
|---|---|---|
printer.Print(filePath) | pdf.Print() | Print to default printer |
printer.Print(path, printerName) | pdf.Print(printerName) | Print to specific printer |
printer.PrinterName = "..." | pdf.Print("...") | Specify printer |
printer.GetPrintDocument(path) | pdf.GetPrintDocument() | Get PrintDocument |
printer.Copies = n | printSettings.NumberOfCopies = n | Copy count |
printer.Duplex = true | printSettings.DuplexMode = Duplex.Vertical | Duplex printing |
printer.CollatePages = true | printSettings.Collate = true | Collation |
New Features Not Available in PDFPrinting.NET
| IronPDF Feature | Description |
|---|---|
renderer.RenderHtmlAsPdf(html) | HTML to PDF conversion |
renderer.RenderUrlAsPdf(url) | URL to PDF conversion |
PdfDocument.Merge(pdfs) | Merge multiple PDFs |
pdf.ApplyWatermark(html) | Add watermarks |
pdf.SecuritySettings.UserPassword | Password protection |
pdf.ExtractAllText() | Text extraction |
Code Migration Examples
Example 1: HTML to PDF Conversion
Before (PDFPrinting.NET):
// NuGet: Install-Package PDFPrinting.NET
using PDFPrinting.NET;
using System;
class Program
{
static void Main()
{
var converter = new HtmlToPdfConverter();
string html = "<html><body><h1>Hello World</h1></body></html>";
converter.ConvertHtmlToPdf(html, "output.pdf");
Console.WriteLine("PDF created successfully");
}
}// NuGet: Install-Package PDFPrinting.NET
using PDFPrinting.NET;
using System;
class Program
{
static void Main()
{
var converter = new HtmlToPdfConverter();
string html = "<html><body><h1>Hello World</h1></body></html>";
converter.ConvertHtmlToPdf(html, "output.pdf");
Console.WriteLine("PDF created successfully");
}
}After (IronPDF):
// NuGet: Install-Package IronPdf
using IronPdf;
using System;
class Program
{
static void Main()
{
var renderer = new ChromePdfRenderer();
string html = "<html><body><h1>Hello World</h1></body></html>";
var pdf = renderer.RenderHtmlAsPdf(html);
pdf.SaveAs("output.pdf");
Console.WriteLine("PDF created successfully");
}
}// NuGet: Install-Package IronPdf
using IronPdf;
using System;
class Program
{
static void Main()
{
var renderer = new ChromePdfRenderer();
string html = "<html><body><h1>Hello World</h1></body></html>";
var pdf = renderer.RenderHtmlAsPdf(html);
pdf.SaveAs("output.pdf");
Console.WriteLine("PDF created successfully");
}
}PDFPrinting.NET uses HtmlToPdfConverter with ConvertHtmlToPdf(html, outputPath) which combines rendering and saving in one call. IronPDF uses ChromePdfRenderer with RenderHtmlAsPdf() which returns a PdfDocument object that you then save with SaveAs(). This separation provides more flexibility—you can manipulate the PDF (add watermarks, merge with other documents, add security) before saving.
IronPDF provides capabilities like HTML-to-PDF conversion which allows developers to render web content as PDFs—capitalizing on modern web technologies for document creation. By leveraging browser engines internally, IronPDF accurately replicates the styling and rendering of web documents into PDFs. See the HTML to PDF documentation for comprehensive examples.
Example 2: URL to PDF Conversion
Before (PDFPrinting.NET):
// NuGet: Install-Package PDFPrinting.NET
using PDFPrinting.NET;
using System;
class Program
{
static void Main()
{
var converter = new WebPageToPdfConverter();
string url = "https://www.example.com";
converter.Convert(url, "webpage.pdf");
Console.WriteLine("PDF from URL created successfully");
}
}// NuGet: Install-Package PDFPrinting.NET
using PDFPrinting.NET;
using System;
class Program
{
static void Main()
{
var converter = new WebPageToPdfConverter();
string url = "https://www.example.com";
converter.Convert(url, "webpage.pdf");
Console.WriteLine("PDF from URL created successfully");
}
}After (IronPDF):
// NuGet: Install-Package IronPdf
using IronPdf;
using System;
class Program
{
static void Main()
{
var renderer = new ChromePdfRenderer();
string url = "https://www.example.com";
var pdf = renderer.RenderUrlAsPdf(url);
pdf.SaveAs("webpage.pdf");
Console.WriteLine("PDF from URL created successfully");
}
}// NuGet: Install-Package IronPdf
using IronPdf;
using System;
class Program
{
static void Main()
{
var renderer = new ChromePdfRenderer();
string url = "https://www.example.com";
var pdf = renderer.RenderUrlAsPdf(url);
pdf.SaveAs("webpage.pdf");
Console.WriteLine("PDF from URL created successfully");
}
}PDFPrinting.NET uses WebPageToPdfConverter with Convert(url, outputPath). IronPDF uses the same ChromePdfRenderer class with RenderUrlAsPdf() method. Note that IronPDF uses a single renderer class for both HTML strings and URLs, simplifying your code when you need both capabilities. Learn more in our tutorials.
Example 3: Headers and Footers
Before (PDFPrinting.NET):
// NuGet: Install-Package PDFPrinting.NET
using PDFPrinting.NET;
using System;
class Program
{
static void Main()
{
var converter = new HtmlToPdfConverter();
converter.HeaderText = "Company Report";
converter.FooterText = "Page {page} of {total}";
string html = "<html><body><h1>Document Content</h1></body></html>";
converter.ConvertHtmlToPdf(html, "report.pdf");
Console.WriteLine("PDF with headers/footers created");
}
}// NuGet: Install-Package PDFPrinting.NET
using PDFPrinting.NET;
using System;
class Program
{
static void Main()
{
var converter = new HtmlToPdfConverter();
converter.HeaderText = "Company Report";
converter.FooterText = "Page {page} of {total}";
string html = "<html><body><h1>Document Content</h1></body></html>";
converter.ConvertHtmlToPdf(html, "report.pdf");
Console.WriteLine("PDF with headers/footers created");
}
}After (IronPDF):
// NuGet: Install-Package IronPdf
using IronPdf;
using IronPdf.Rendering;
using System;
class Program
{
static void Main()
{
var renderer = new ChromePdfRenderer();
renderer.RenderingOptions.HtmlHeader = new HtmlHeaderFooter()
{
HtmlFragment = "<div style='text-align:center'>Company Report</div>"
};
renderer.RenderingOptions.HtmlFooter = new HtmlHeaderFooter()
{
HtmlFragment = "<div style='text-align:center'>Page {page} of {total-pages}</div>"
};
string html = "<html><body><h1>Document Content</h1></body></html>";
var pdf = renderer.RenderHtmlAsPdf(html);
pdf.SaveAs("report.pdf");
Console.WriteLine("PDF with headers/footers created");
}
}// NuGet: Install-Package IronPdf
using IronPdf;
using IronPdf.Rendering;
using System;
class Program
{
static void Main()
{
var renderer = new ChromePdfRenderer();
renderer.RenderingOptions.HtmlHeader = new HtmlHeaderFooter()
{
HtmlFragment = "<div style='text-align:center'>Company Report</div>"
};
renderer.RenderingOptions.HtmlFooter = new HtmlHeaderFooter()
{
HtmlFragment = "<div style='text-align:center'>Page {page} of {total-pages}</div>"
};
string html = "<html><body><h1>Document Content</h1></body></html>";
var pdf = renderer.RenderHtmlAsPdf(html);
pdf.SaveAs("report.pdf");
Console.WriteLine("PDF with headers/footers created");
}
}PDFPrinting.NET uses simple string properties HeaderText and FooterText with placeholders {page} and {total}. IronPDF uses HtmlHeaderFooter objects with an HtmlFragment property that accepts full HTML, allowing rich styling with CSS. Note the placeholder syntax change: PDFPrinting.NET uses {total} while IronPDF uses {total-pages}.
Critical Migration Notes
Placeholder Syntax Change
Header/footer placeholders differ between libraries:
// PDFPrinting.NET placeholders
"Page {page} of {total}"
// IronPDF placeholders
"Page {page} of {total-pages}"// PDFPrinting.NET placeholders
"Page {page} of {total}"
// IronPDF placeholders
"Page {page} of {total-pages}"Load-Then-Print Pattern
PDFPrinting.NET passes file paths directly; IronPDF loads first:
// PDFPrinting.NET: Direct path to Print()
printer.Print("document.pdf");
// IronPDF: Load first, then operate
var pdf = PdfDocument.FromFile("document.pdf");
pdf.Print();// PDFPrinting.NET: Direct path to Print()
printer.Print("document.pdf");
// IronPDF: Load first, then operate
var pdf = PdfDocument.FromFile("document.pdf");
pdf.Print();Print Settings Migration
PDFPrinting.NET uses properties; IronPDF uses a settings object:
// PDFPrinting.NET: Properties on printer object
printer.Copies = 2;
printer.Duplex = true;
// IronPDF: Settings object
var settings = new PrintSettings
{
NumberOfCopies = 2,
DuplexMode = System.Drawing.Printing.Duplex.Vertical
};
pdf.Print(settings);// PDFPrinting.NET: Properties on printer object
printer.Copies = 2;
printer.Duplex = true;
// IronPDF: Settings object
var settings = new PrintSettings
{
NumberOfCopies = 2,
DuplexMode = System.Drawing.Printing.Duplex.Vertical
};
pdf.Print(settings);HTML Headers vs Text Headers
// PDFPrinting.NET: Simple text
converter.HeaderText = "Company Report";
// IronPDF: Full HTML with styling
renderer.RenderingOptions.HtmlHeader = new HtmlHeaderFooter()
{
HtmlFragment = "<div style='text-align:center'>Company Report</div>"
};// PDFPrinting.NET: Simple text
converter.HeaderText = "Company Report";
// IronPDF: Full HTML with styling
renderer.RenderingOptions.HtmlHeader = new HtmlHeaderFooter()
{
HtmlFragment = "<div style='text-align:center'>Company Report</div>"
};New Capabilities After Migration
After migrating to IronPDF, you gain capabilities that PDFPrinting.NET 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");Watermarks
pdf.ApplyWatermark("<h2 style='color:red;'>CONFIDENTIAL</h2>");pdf.ApplyWatermark("<h2 style='color:red;'>CONFIDENTIAL</h2>");Password Protection
pdf.SecuritySettings.UserPassword = "userpassword";
pdf.SecuritySettings.OwnerPassword = "ownerpassword";pdf.SecuritySettings.UserPassword = "userpassword";
pdf.SecuritySettings.OwnerPassword = "ownerpassword";Text Extraction
string text = pdf.ExtractAllText();string text = pdf.ExtractAllText();Generate-Then-Print Workflow
With IronPDF, you can generate PDFs and print them in one workflow:
var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderHtmlAsPdf("<h1>Invoice</h1>");
pdf.Print("Invoice Printer");var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderHtmlAsPdf("<h1>Invoice</h1>");
pdf.Print("Invoice Printer");Cross-Platform Printing
PDFPrinting.NET is Windows-only. IronPDF works cross-platform:
Windows
pdf.Print("HP LaserJet");pdf.Print("HP LaserJet");Linux
// Requires CUPS (Common Unix Printing System)
// Install: apt-get install cups
pdf.Print("HP_LaserJet"); // CUPS uses underscores instead of spaces// Requires CUPS (Common Unix Printing System)
// Install: apt-get install cups
pdf.Print("HP_LaserJet"); // CUPS uses underscores instead of spacesmacOS
pdf.Print("HP LaserJet");pdf.Print("HP LaserJet");Feature Comparison Summary
| Feature | PDFPrinting.NET | IronPDF |
|---|---|---|
| Silent Printing | ✓ | ✓ |
| Print Settings | ✓ | ✓ |
| HTML to PDF | ✗ | ✓ |
| URL to PDF | ✗ | ✓ |
| Headers/Footers | Basic | Full HTML |
| Merge PDFs | ✗ | ✓ |
| Split PDFs | ✗ | ✓ |
| Watermarks | ✗ | ✓ |
| Text Extraction | ✗ | ✓ |
| Password Protection | ✗ | ✓ |
| Cross-Platform | ✗ | ✓ |
Migration Checklist
Pre-Migration
- Inventory all PDFPrinting.NET usage in codebase
- Document all printer names currently used
- Note all print settings configurations
- Identify if cross-platform support is needed
- Plan IronPDF license key storage (environment variables recommended)
- Test with IronPDF trial license first
Package Changes
- Remove
PDFPrinting.NETNuGet package - Install
IronPdfNuGet package:dotnet add package IronPdf
Code Changes
- Update namespace imports
- Replace
HtmlToPdfConverterwithChromePdfRenderer - Replace
WebPageToPdfConverterwithChromePdfRenderer - Replace
ConvertHtmlToPdf(html, path)withRenderHtmlAsPdf(html).SaveAs(path) - Replace
Convert(url, path)withRenderUrlAsPdf(url).SaveAs(path) - Update header/footer from
HeaderText/FooterTexttoHtmlHeader/HtmlFooter - Update placeholder syntax (
{total}→{total-pages}) - Convert print calls to load-then-print pattern
- Update print settings to
PrintSettingsobject
Post-Migration
- Test printing on all target platforms
- Verify header/footer rendering
- Consider adding PDF generation for dynamic documents
- Add new capabilities (merging, watermarks, security) as needed






