푸터 콘텐츠로 바로가기
MIGRATION GUIDES

How to Migrate from Sumatra PDF to IronPDF in C#

Migrating from Sumatra PDF to IronPDF transforms your PDF workflow from external process management with a desktop viewer application to native .NET library integration with full PDF creation, manipulation, and extraction capabilities. This guide provides a complete, step-by-step migration path that eliminates external dependencies, GPL license restrictions, and the fundamental limitation that Sumatra PDF is a viewer, not a development library.

Why Migrate from Sumatra PDF to IronPDF

Understanding Sumatra PDF

Sumatra PDF is primarily a lightweight, open-source PDF reader renowned for its simplicity and speed. However, Sumatra PDF does not provide the capabilities needed for creating or manipulating PDF files beyond viewing them. As a free and versatile option for reading PDFs, it is adored by many users seeking a no-frills experience. But when it comes to developers needing more comprehensive PDF functionalities like creation and library integration within applications, Sumatra PDF falls short due to its inherent design limitations.

Sumatra PDF is a desktop PDF viewer application, not a development library. If you're using Sumatra PDF in your .NET application, you're likely:

  1. Launching it as an external process to display PDFs
  2. Using it for printing PDFs via command-line
  3. Relying on it as a dependency your users must install

Key Problems with Sumatra PDF Integration

Problem Impact
Not a Library Cannot programmatically create or edit PDFs
External Process Requires spawning separate processes
GPL License Restrictive for commercial software
User Dependency Users must install Sumatra separately
No API Limited to command-line arguments
View-Only Cannot create, edit, or manipulate PDFs
No Web Support Desktop-only application

Sumatra PDF vs IronPDF Comparison

Feature Sumatra PDF IronPDF
Type Application Library
PDF Reading Yes Yes
PDF Creation No Yes
PDF Editing No Yes
Integration Limited (standalone) Full integration in applications
License GPL Commercial
Create PDFs No Yes
Edit PDFs No Yes
HTML to PDF No Yes
Merge/Split No Yes
Watermarks No Yes
Digital Signatures No Yes
Form Filling No Yes
Text Extraction No Yes
.NET Integration None Native
Web Applications No Yes

IronPDF, unlike Sumatra PDF, is not tied to any specific desktop application or external process. It provides developers with a flexible library to dynamically create, edit, and manipulate PDF documents directly in C#. This decoupling from external processes offers a noticeable advantage—it is straightforward and adaptable, suitable for a wide array of applications beyond just viewing.

For teams planning .NET 10 and C# 14 adoption through 2025 and 2026, IronPDF provides native library integration that eliminates the external process overhead and GPL license restrictions of Sumatra PDF.


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

Installation

# Install IronPDF
dotnet add package IronPdf
# Install IronPDF
dotnet add package IronPdf
SHELL

License Configuration

// Add at application startup
IronPdf.License.LicenseKey = "YOUR-LICENSE-KEY";
// Add at application startup
IronPdf.License.LicenseKey = "YOUR-LICENSE-KEY";
$vbLabelText   $csharpLabel

Complete API Reference

Namespace Changes

// Before: Sumatra PDF (external process)
using System.Diagnostics;
using System.IO;

// After: IronPDF
using IronPdf;
// Before: Sumatra PDF (external process)
using System.Diagnostics;
using System.IO;

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

Core Capability Mappings

Sumatra PDF Approach IronPDF Equivalent Notes
Process.Start("SumatraPDF.exe", pdfPath) PdfDocument.FromFile() Load PDF
Command-line arguments Native API methods No CLI needed
External pdftotext.exe pdf.ExtractAllText() Text extraction
External wkhtmltopdf.exe renderer.RenderHtmlAsPdf() HTML to PDF
-print-to-default argument pdf.Print() Printing
Not possible PdfDocument.Merge() Merge PDFs
Not possible pdf.ApplyWatermark() Watermarks
Not possible pdf.SecuritySettings Password protection

Code Migration Examples

Example 1: HTML to PDF Conversion

Before (Sumatra PDF):

// NuGet: Install-Package SumatraPDF (Note: Sumatra is primarily a viewer, not a generator)
// Sumatra PDF doesn't have direct C# integration for HTML to PDF conversion
// You would need to use external tools or libraries and then open with Sumatra
using System.Diagnostics;
using System.IO;

class Program
{
    static void Main()
    {
        // Sumatra PDF cannot directly convert HTML to PDF
        // You'd need to use wkhtmltopdf or similar, then view in Sumatra
        string htmlFile = "input.html";
        string pdfFile = "output.pdf";

        // Using wkhtmltopdf as intermediary
        ProcessStartInfo psi = new ProcessStartInfo
        {
            FileName = "wkhtmltopdf.exe",
            Arguments = $"{htmlFile} {pdfFile}",
            UseShellExecute = false
        };
        Process.Start(psi)?.WaitForExit();

        // Then open with Sumatra
        Process.Start("SumatraPDF.exe", pdfFile);
    }
}
// NuGet: Install-Package SumatraPDF (Note: Sumatra is primarily a viewer, not a generator)
// Sumatra PDF doesn't have direct C# integration for HTML to PDF conversion
// You would need to use external tools or libraries and then open with Sumatra
using System.Diagnostics;
using System.IO;

class Program
{
    static void Main()
    {
        // Sumatra PDF cannot directly convert HTML to PDF
        // You'd need to use wkhtmltopdf or similar, then view in Sumatra
        string htmlFile = "input.html";
        string pdfFile = "output.pdf";

        // Using wkhtmltopdf as intermediary
        ProcessStartInfo psi = new ProcessStartInfo
        {
            FileName = "wkhtmltopdf.exe",
            Arguments = $"{htmlFile} {pdfFile}",
            UseShellExecute = false
        };
        Process.Start(psi)?.WaitForExit();

        // Then open with Sumatra
        Process.Start("SumatraPDF.exe", pdfFile);
    }
}
$vbLabelText   $csharpLabel

After (IronPDF):

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

class Program
{
    static void Main()
    {
        var renderer = new ChromePdfRenderer();

        string htmlContent = "<h1>Hello World</h1><p>This is HTML to PDF conversion.</p>";

        var pdf = renderer.RenderHtmlAsPdf(htmlContent);
        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 htmlContent = "<h1>Hello World</h1><p>This is HTML to PDF conversion.</p>";

        var pdf = renderer.RenderHtmlAsPdf(htmlContent);
        pdf.SaveAs("output.pdf");

        Console.WriteLine("PDF created successfully!");
    }
}
$vbLabelText   $csharpLabel

This example demonstrates the fundamental architectural difference. Sumatra PDF cannot directly convert HTML to PDF—you must use an external tool like wkhtmltopdf as an intermediary, then launch Sumatra as a separate process to view the result. This requires two external executables and multiple process launches.

IronPDF uses a ChromePdfRenderer with RenderHtmlAsPdf() in just three lines of code. No external tools, no process management, no intermediary files. The PDF is created directly in memory and saved with SaveAs(). See the HTML to PDF documentation for comprehensive examples.

Example 2: Opening and Displaying PDFs

Before (Sumatra PDF):

// NuGet: Install-Package SumatraPDF.CommandLine (or direct executable)
using System.Diagnostics;
using System.IO;

class Program
{
    static void Main()
    {
        string pdfPath = "document.pdf";

        // Sumatra PDF excels at viewing PDFs
        ProcessStartInfo startInfo = new ProcessStartInfo
        {
            FileName = "SumatraPDF.exe",
            Arguments = $"\"{pdfPath}\"",
            UseShellExecute = true
        };

        Process.Start(startInfo);

        // Optional: Open specific page
        // Arguments = $"-page 5 \"{pdfPath}\""
    }
}
// NuGet: Install-Package SumatraPDF.CommandLine (or direct executable)
using System.Diagnostics;
using System.IO;

class Program
{
    static void Main()
    {
        string pdfPath = "document.pdf";

        // Sumatra PDF excels at viewing PDFs
        ProcessStartInfo startInfo = new ProcessStartInfo
        {
            FileName = "SumatraPDF.exe",
            Arguments = $"\"{pdfPath}\"",
            UseShellExecute = true
        };

        Process.Start(startInfo);

        // Optional: Open specific page
        // Arguments = $"-page 5 \"{pdfPath}\""
    }
}
$vbLabelText   $csharpLabel

After (IronPDF):

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

class Program
{
    static void Main()
    {
        var pdf = PdfDocument.FromFile("document.pdf");

        // Extract information
        Console.WriteLine($"Page Count: {pdf.PageCount}");

        // IronPDF can manipulate and save, then open with default viewer
        pdf.SaveAs("modified.pdf");

        // Open with default PDF viewer
        Process.Start(new ProcessStartInfo("modified.pdf") { UseShellExecute = true });
    }
}
// NuGet: Install-Package IronPdf
using IronPdf;
using System;
using System.Diagnostics;

class Program
{
    static void Main()
    {
        var pdf = PdfDocument.FromFile("document.pdf");

        // Extract information
        Console.WriteLine($"Page Count: {pdf.PageCount}");

        // IronPDF can manipulate and save, then open with default viewer
        pdf.SaveAs("modified.pdf");

        // Open with default PDF viewer
        Process.Start(new ProcessStartInfo("modified.pdf") { UseShellExecute = true });
    }
}
$vbLabelText   $csharpLabel

Sumatra PDF excels at viewing PDFs, but it's limited to launching an external process with command-line arguments. You cannot programmatically access the PDF content—only display it.

IronPDF loads the PDF with PdfDocument.FromFile(), giving you full programmatic access. You can read properties like PageCount, manipulate the document, save changes, and then open with the system's default PDF viewer. The key difference is that IronPDF provides an actual API, not just process arguments. Learn more in our tutorials.

Example 3: Extracting Text from PDFs

Before (Sumatra PDF):

// Sumatra PDF doesn't provide C# API for text extraction
// You would need to use command-line tools or other libraries
using System.Diagnostics;
using System.IO;

class Program
{
    static void Main()
    {
        // Sumatra PDF is a viewer, not a text extraction library
        // You'd need to use PDFBox, iTextSharp, or similar for extraction

        string pdfFile = "document.pdf";

        // This would require external tools like pdftotext
        ProcessStartInfo psi = new ProcessStartInfo
        {
            FileName = "pdftotext.exe",
            Arguments = $"{pdfFile} output.txt",
            UseShellExecute = false
        };

        Process.Start(psi)?.WaitForExit();

        string extractedText = File.ReadAllText("output.txt");
        Console.WriteLine(extractedText);
    }
}
// Sumatra PDF doesn't provide C# API for text extraction
// You would need to use command-line tools or other libraries
using System.Diagnostics;
using System.IO;

class Program
{
    static void Main()
    {
        // Sumatra PDF is a viewer, not a text extraction library
        // You'd need to use PDFBox, iTextSharp, or similar for extraction

        string pdfFile = "document.pdf";

        // This would require external tools like pdftotext
        ProcessStartInfo psi = new ProcessStartInfo
        {
            FileName = "pdftotext.exe",
            Arguments = $"{pdfFile} output.txt",
            UseShellExecute = false
        };

        Process.Start(psi)?.WaitForExit();

        string extractedText = File.ReadAllText("output.txt");
        Console.WriteLine(extractedText);
    }
}
$vbLabelText   $csharpLabel

After (IronPDF):

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

class Program
{
    static void Main()
    {
        var pdf = PdfDocument.FromFile("document.pdf");

        // Extract text from all pages
        string allText = pdf.ExtractAllText();
        Console.WriteLine("Extracted Text:");
        Console.WriteLine(allText);

        // Extract text from specific page
        string pageText = pdf.ExtractTextFromPage(0);
        Console.WriteLine($"\nFirst Page Text:\n{pageText}");
    }
}
// NuGet: Install-Package IronPdf
using IronPdf;
using System;

class Program
{
    static void Main()
    {
        var pdf = PdfDocument.FromFile("document.pdf");

        // Extract text from all pages
        string allText = pdf.ExtractAllText();
        Console.WriteLine("Extracted Text:");
        Console.WriteLine(allText);

        // Extract text from specific page
        string pageText = pdf.ExtractTextFromPage(0);
        Console.WriteLine($"\nFirst Page Text:\n{pageText}");
    }
}
$vbLabelText   $csharpLabel

Sumatra PDF is a viewer, not a text extraction library. To extract text, you must use external command-line tools like pdftotext.exe, spawn a process, wait for it to complete, read the output file, and handle all the associated file I/O and cleanup.

IronPDF provides native text extraction with ExtractAllText() for the entire document or ExtractTextFromPage(0) for specific pages. No external processes, no temporary files, no cleanup required.


Feature Comparison

Feature Sumatra PDF IronPDF
:Creation: HTML to PDF No Yes
URL to PDF No Yes
Text to PDF No Yes
Image to PDF No Yes
:Manipulation: Merge PDFs No Yes
Split PDFs No Yes
Rotate Pages No Yes
Delete Pages No Yes
Reorder Pages No Yes
:Content: Add Watermarks No Yes
Add Headers/Footers No Yes
Stamp Text No Yes
Stamp Images No Yes
:Security: Password Protection No Yes
Digital Signatures No Yes
Encryption No Yes
Permission Settings No Yes
:Extraction: Extract Text No Yes
Extract Images No Yes
:Platform: Windows Yes Yes
Linux No Yes
macOS No Yes
Web Apps No Yes
Azure/AWS No Yes

New Capabilities After Migration

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

PDF Creation from HTML

var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderHtmlAsPdf(@"
    <html>
    <head><style>body { font-family: Arial; }</style></head>
    <body>
        <h1>Invoice #12345</h1>
        <p>Thank you for your purchase.</p>
    </body>
    </html>");

pdf.SaveAs("invoice.pdf");
var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderHtmlAsPdf(@"
    <html>
    <head><style>body { font-family: Arial; }</style></head>
    <body>
        <h1>Invoice #12345</h1>
        <p>Thank you for your purchase.</p>
    </body>
    </html>");

pdf.SaveAs("invoice.pdf");
$vbLabelText   $csharpLabel

PDF Merging

var pdf1 = PdfDocument.FromFile("chapter1.pdf");
var pdf2 = PdfDocument.FromFile("chapter2.pdf");
var pdf3 = PdfDocument.FromFile("chapter3.pdf");

var book = PdfDocument.Merge(pdf1, pdf2, pdf3);
book.SaveAs("complete_book.pdf");
var pdf1 = PdfDocument.FromFile("chapter1.pdf");
var pdf2 = PdfDocument.FromFile("chapter2.pdf");
var pdf3 = PdfDocument.FromFile("chapter3.pdf");

var book = PdfDocument.Merge(pdf1, pdf2, pdf3);
book.SaveAs("complete_book.pdf");
$vbLabelText   $csharpLabel

Watermarks

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

pdf.ApplyWatermark(@"
    <div style='
        font-size: 60pt;
        color: rgba(255, 0, 0, 0.3);
        transform: rotate(-45deg);
    '>
        CONFIDENTIAL
    </div>");

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

pdf.ApplyWatermark(@"
    <div style='
        font-size: 60pt;
        color: rgba(255, 0, 0, 0.3);
        transform: rotate(-45deg);
    '>
        CONFIDENTIAL
    </div>");

pdf.SaveAs("watermarked.pdf");
$vbLabelText   $csharpLabel

Password Protection

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

pdf.SecuritySettings.OwnerPassword = "owner123";
pdf.SecuritySettings.UserPassword = "user456";
pdf.SecuritySettings.AllowUserCopyPasteContent = false;
pdf.SecuritySettings.AllowUserPrinting = PdfPrintSecurity.NoPrint;

pdf.SaveAs("protected.pdf");
var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderHtmlAsPdf("<h1>Sensitive Data</h1>");

pdf.SecuritySettings.OwnerPassword = "owner123";
pdf.SecuritySettings.UserPassword = "user456";
pdf.SecuritySettings.AllowUserCopyPasteContent = false;
pdf.SecuritySettings.AllowUserPrinting = PdfPrintSecurity.NoPrint;

pdf.SaveAs("protected.pdf");
$vbLabelText   $csharpLabel

Migration Checklist

Pre-Migration

  • Identify all Sumatra process launches (Process.Start("SumatraPDF.exe", ...))
  • Document print workflows (-print-to-default arguments)
  • Note any Sumatra command-line arguments used
  • Obtain IronPDF license key from ironpdf.com

Code Updates

  • Install IronPdf NuGet package
  • Remove Sumatra process code
  • Replace Process.Start("SumatraPDF.exe", pdfPath) with PdfDocument.FromFile(pdfPath)
  • Replace external wkhtmltopdf.exe calls with ChromePdfRenderer.RenderHtmlAsPdf()
  • Replace external pdftotext.exe calls with pdf.ExtractAllText()
  • Replace -print-to-default process calls with pdf.Print()
  • Add license initialization at application startup

Testing

  • Test PDF generation quality
  • Verify print functionality
  • Test on all target platforms
  • Verify no Sumatra dependency remains

Cleanup

  • Remove Sumatra from installers
  • Update documentation
  • Remove Sumatra from system requirements

커티스 차우
기술 문서 작성자

커티스 차우는 칼턴 대학교에서 컴퓨터 과학 학사 학위를 취득했으며, Node.js, TypeScript, JavaScript, React를 전문으로 하는 프론트엔드 개발자입니다. 직관적이고 미적으로 뛰어난 사용자 인터페이스를 만드는 데 열정을 가진 그는 최신 프레임워크를 활용하고, 잘 구성되고 시각적으로 매력적인 매뉴얼을 제작하는 것을 즐깁니다.

커티스는 개발 분야 외에도 사물 인터넷(IoT)에 깊은 관심을 가지고 있으며, 하드웨어와 소프트웨어를 통합하는 혁신적인 방법을 연구합니다. 여가 시간에는 게임을 즐기거나 디스코드 봇을 만들면서 기술에 대한 애정과 창의성을 결합합니다.