Jak przeprowadzić migrację z Syncfusion PDF do IronPDF w języku C#
Full Comparison
Looking for a detailed feature-by-feature breakdown? See how IronPDF stacks up against Syncfusion PDF on pricing, HTML support, and licensing.
Migrating fromSyncfusion PDFFramework toIronPDFtransforms your PDF generation workflow from a coordinate-based graphics API bundled within a large suite to a standalone,HTML/CSS-najpierwlibrary with modern Chromium rendering. This guide provides a complete, step-by-step migration path that eliminates suite-only licensing, complex deployment requirements, and coordinate-based positioning.
Why Migrate fromSyncfusion PDFto IronPDF
UnderstandingSyncfusion PDFFramework
TheSyncfusion PDFFramework is a comprehensive library that provides a wide range of functionalities for creating, editing, and securing PDF documents using C#. It comes as a part of Syncfusion's Essential Studio, which includes over a thousand components across multiple platforms.
However, one of its most significant drawbacks is that it cannot be purchased as a standalone product; developers must buy the entire suite ofSyncfusioncomponents. This requirement can be cumbersome for teams interested solely in PDF functionalities, especially since this bundle might include tools unnecessary for their projects.
The Bundle Licensing Problem
Model licencyjny firmySyncfusionstwarza poważne wyzwania dla zespołów, które potrzebują wyłącznie funkcji związanych z plikami PDF:
- Suite-Only Purchase: Cannot buy PDF library standalone—must purchase entire Essential Studio
- Community License Restrictions: Free tier requires BOTH <$1M revenue AND <5 developers
- Complex Deployment Licensing: Different licenses for web, desktop, server deployments
- Annual Renewal Required: Subscription model with yearly costs
- Per-Developer Pricing: Costs scale linearly with team size
- Suite Bloat: Includes 1000+ components you may not need
Syncfusion PDFvsIronPDFComparison
| Aspekt | Syncfusion PDF | IronPDF |
|---|---|---|
| Model zakupu | Tylko pakiet Suite | Samodzielny |
| Licencjonowanie | Złożone warstwy | Prosty dla każdego programisty |
| Community Limit | <$1M AND <5 devs | Bezpłatna wersja próbna, a następnie licencja |
| Wdrożenie | Różne rodzaje licencji | Jedna licencja obejmuje wszystkie |
| Styl API | Grafika oparta na współrzędnych | HTML/CSS-najpierw |
| Obsługa HTML | Wymaga BlinkBinaries | Natywny Chromium |
| Obsługa CSS | Ograniczone | Pełna obsługa CSS3/flexbox/grid |
| Zależności | Wiele pakietów | Pojedynczy NuGet |
| Wymagania dotyczące Suite | Tak (cała Suite) | Nie |
| Skup się na pliku PDF | Ogólne; part of larger suite | Wąski; Skupione na PDF |
IronPDF provides a more focused approach by offering its PDF capabilities as a standalone product. This difference significantly impacts both cost considerations and ease of integration.
For teams planning .NET 10 and C# 14 adoption through 2025 and 2026, IronPDF's standalone licensing andHTML/CSS-najpierwapproach provides flexibility without suite dependencies.
Zanim zaczniesz
Wymagania wstępne
- Środowisko .NET: .NET Framework 4.6.2+ lub .NET Core 3.1+ / .NET 5/6/7/8/9+
- Dostęp do NuGet: Możliwość instalowania pakietów NuGet
- Licencja IronPDF: Uzyskaj klucz licencyjny na stronie ironpdf.com
Zmiany w pakiecie NuGet
# RemoveSyncfusionpackages
dotnet remove package Syncfusion.Pdf.Net.Core
dotnet remove package Syncfusion.HtmlToPdfConverter.Net.Windows
dotnet remove package Syncfusion.Licensing
# Install IronPDF
dotnet add package IronPdf
# RemoveSyncfusionpackages
dotnet remove package Syncfusion.Pdf.Net.Core
dotnet remove package Syncfusion.HtmlToPdfConverter.Net.Windows
dotnet remove package Syncfusion.Licensing
# Install IronPDF
dotnet add package IronPdf
Konfiguracja licencji
Syncfusion:
// Must register before anySyncfusioncalls
Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("YOUR-SYNCFUSION-KEY");
// Must register before anySyncfusioncalls
Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("YOUR-SYNCFUSION-KEY");
' Must register before any Syncfusion calls
Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("YOUR-SYNCFUSION-KEY")
IronPDF:
// One-time at startup
IronPdf.License.LicenseKey = "YOUR-IRONPDF-KEY";
// One-time at startup
IronPdf.License.LicenseKey = "YOUR-IRONPDF-KEY";
' One-time at startup
IronPdf.License.LicenseKey = "YOUR-IRONPDF-KEY"
Kompletna dokumentacija API
Zmiany w przestrzeni nazw
// Before:SyncfusionPDF
using Syncfusion.Pdf;
using Syncfusion.Pdf.Graphics;
using Syncfusion.Pdf.Parsing;
using Syncfusion.HtmlConverter;
using Syncfusion.Drawing;
// After: IronPDF
using IronPdf;
using IronPdf.Rendering;
// Before:SyncfusionPDF
using Syncfusion.Pdf;
using Syncfusion.Pdf.Graphics;
using Syncfusion.Pdf.Parsing;
using Syncfusion.HtmlConverter;
using Syncfusion.Drawing;
// After: IronPDF
using IronPdf;
using IronPdf.Rendering;
Imports IronPdf
Imports IronPdf.Rendering
Mapowania podstawowych interfejsów API
| Syncfusion | IronPDF |
|---|---|
PdfDocument |
ChromePdfRenderer |
PdfLoadedDocument |
PdfDocument.FromFile() |
HtmlToPdfConverter |
ChromePdfRenderer |
graphics.DrawString() |
Elementy tekstowe HTML |
graphics.DrawImage() |
<img> tag |
PdfGrid |
HTML <table> |
PdfStandardFont |
CSS font-family |
PdfBrushes.Black |
CSS color: black |
document.Security |
pdf.SecuritySettings |
PdfTextExtractor |
pdf.ExtractAllText() |
ImportPageRange() |
PdfDocument.Merge() |
document.Save(stream) |
pdf.SaveAs(path) |
document.Close(true) |
Nie jest potrzebne |
Przykłady migracji kodu
Example 1: HTML/URL to PDF Conversion
Before (Syncfusion PDF):
// NuGet: Install-Package Syncfusion.Pdf.Net.Core
using Syncfusion.HtmlConverter;
using Syncfusion.Pdf;
using System.IO;
class Program
{
static void Main()
{
// Initialize HTML to PDF converter
HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter();
// Convert URL to PDF
PdfDocument document = htmlConverter.Convert("https://www.example.com");
// Save the document
FileStream fileStream = new FileStream("Output.pdf", FileMode.Create);
document.Save(fileStream);
document.Close(true);
fileStream.Close();
}
}
// NuGet: Install-Package Syncfusion.Pdf.Net.Core
using Syncfusion.HtmlConverter;
using Syncfusion.Pdf;
using System.IO;
class Program
{
static void Main()
{
// Initialize HTML to PDF converter
HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter();
// Convert URL to PDF
PdfDocument document = htmlConverter.Convert("https://www.example.com");
// Save the document
FileStream fileStream = new FileStream("Output.pdf", FileMode.Create);
document.Save(fileStream);
document.Close(true);
fileStream.Close();
}
}
Imports Syncfusion.HtmlConverter
Imports Syncfusion.Pdf
Imports System.IO
Module Program
Sub Main()
' Initialize HTML to PDF converter
Dim htmlConverter As New HtmlToPdfConverter()
' Convert URL to PDF
Dim document As PdfDocument = htmlConverter.Convert("https://www.example.com")
' Save the document
Dim fileStream As New FileStream("Output.pdf", FileMode.Create)
document.Save(fileStream)
document.Close(True)
fileStream.Close()
End Sub
End Module
Po (IronPDF):
// NuGet: Install-Package IronPdf
using IronPdf;
class Program
{
static void Main()
{
// Create a PDF from a URL
var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderUrlAsPdf("https://www.example.com");
// Save the PDF
pdf.SaveAs("Output.pdf");
}
}
// NuGet: Install-Package IronPdf
using IronPdf;
class Program
{
static void Main()
{
// Create a PDF from a URL
var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderUrlAsPdf("https://www.example.com");
// Save the PDF
pdf.SaveAs("Output.pdf");
}
}
Imports IronPdf
Class Program
Shared Sub Main()
' Create a PDF from a URL
Dim renderer = New ChromePdfRenderer()
Dim pdf = renderer.RenderUrlAsPdf("https://www.example.com")
' Save the PDF
pdf.SaveAs("Output.pdf")
End Sub
End Class
This example demonstrates the fundamental API differences.Syncfusion PDFrequires an HtmlToPdfConverter instance, calling Convert() which returns a PdfDocument, then manually creating a FileStream, saving, and closing both the document and stream.
IronPDF uses a ChromePdfRenderer with RenderUrlAsPdf() in just three lines of code. Nie FileStream management, no Close() calls—IronPDF handles cleanup automatically. Kompleksowe przykłady można znaleźć w dokumentacji dotyczącej konwersji HTML do PDF.
Example 2: Creating PDF from Text
Before (Syncfusion PDF):
// NuGet: Install-Package Syncfusion.Pdf.Net.Core
using Syncfusion.Pdf;
using Syncfusion.Pdf.Graphics;
using Syncfusion.Drawing;
using System.IO;
class Program
{
static void Main()
{
// Create a new PDF document
PdfDocument document = new PdfDocument();
// Add a page
PdfPage page = document.Pages.Add();
// Create a font
PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 12);
// Draw text
page.Graphics.DrawString("Hello, World!", font, PdfBrushes.Black, new PointF(10, 10));
// Save the document
FileStream fileStream = new FileStream("Output.pdf", FileMode.Create);
document.Save(fileStream);
document.Close(true);
fileStream.Close();
}
}
// NuGet: Install-Package Syncfusion.Pdf.Net.Core
using Syncfusion.Pdf;
using Syncfusion.Pdf.Graphics;
using Syncfusion.Drawing;
using System.IO;
class Program
{
static void Main()
{
// Create a new PDF document
PdfDocument document = new PdfDocument();
// Add a page
PdfPage page = document.Pages.Add();
// Create a font
PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 12);
// Draw text
page.Graphics.DrawString("Hello, World!", font, PdfBrushes.Black, new PointF(10, 10));
// Save the document
FileStream fileStream = new FileStream("Output.pdf", FileMode.Create);
document.Save(fileStream);
document.Close(true);
fileStream.Close();
}
}
Imports Syncfusion.Pdf
Imports Syncfusion.Pdf.Graphics
Imports Syncfusion.Drawing
Imports System.IO
Module Program
Sub Main()
' Create a new PDF document
Dim document As New PdfDocument()
' Add a page
Dim page As PdfPage = document.Pages.Add()
' Create a font
Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Helvetica, 12)
' Draw text
page.Graphics.DrawString("Hello, World!", font, PdfBrushes.Black, New PointF(10, 10))
' Save the document
Dim fileStream As New FileStream("Output.pdf", FileMode.Create)
document.Save(fileStream)
document.Close(True)
fileStream.Close()
End Sub
End Module
Po (IronPDF):
// NuGet: Install-Package IronPdf
using IronPdf;
using IronPdf.Rendering;
class Program
{
static void Main()
{
// Create a PDF from HTML string
var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderHtmlAsPdf("<h1>Hello, World!</h1>");
// Save the document
pdf.SaveAs("Output.pdf");
}
}
// NuGet: Install-Package IronPdf
using IronPdf;
using IronPdf.Rendering;
class Program
{
static void Main()
{
// Create a PDF from HTML string
var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderHtmlAsPdf("<h1>Hello, World!</h1>");
// Save the document
pdf.SaveAs("Output.pdf");
}
}
Imports IronPdf
Imports IronPdf.Rendering
Class Program
Shared Sub Main()
' Create a PDF from HTML string
Dim renderer As New ChromePdfRenderer()
Dim pdf = renderer.RenderHtmlAsPdf("<h1>Hello, World!</h1>")
' Save the document
pdf.SaveAs("Output.pdf")
End Sub
End Class
Syncfusion PDF uses a coordinate-based graphics model. You create a PdfDocument, add a PdfPage, create a PdfFont with PdfFontFamily.Helvetica, then call page.Graphics.DrawString() with explicit coordinates (new PointF(10, 10)), font, and brush (PdfBrushes.Black). Finally, you manage FileStream creation and disposal.
IronPDF stosuje podejście oparte na HTML/CSS. Instead of coordinates, you write <h1>Hello, World!</h1> and let CSS handle positioning, fonts, and colors. Takie podejście jest prostsze, łatwiejsze w utrzymaniu i wykorzystuje umiejętności, które programiści już posiadają. Dowiedz się więcej z naszych samouczków.
Przykład 3: Łączenie dokumentów PDF
Before (Syncfusion PDF):
// NuGet: Install-Package Syncfusion.Pdf.Net.Core
using Syncfusion.Pdf;
using Syncfusion.Pdf.Parsing;
using System.IO;
class Program
{
static void Main()
{
// Load the first PDF document
FileStream stream1 = new FileStream("Document1.pdf", FileMode.Open, FileAccess.Read);
PdfLoadedDocument loadedDocument1 = new PdfLoadedDocument(stream1);
// Load the second PDF document
FileStream stream2 = new FileStream("Document2.pdf", FileMode.Open, FileAccess.Read);
PdfLoadedDocument loadedDocument2 = new PdfLoadedDocument(stream2);
// Merge the documents
PdfDocument finalDocument = new PdfDocument();
finalDocument.ImportPageRange(loadedDocument1, 0, loadedDocument1.Pages.Count - 1);
finalDocument.ImportPageRange(loadedDocument2, 0, loadedDocument2.Pages.Count - 1);
// Save the merged document
FileStream outputStream = new FileStream("Merged.pdf", FileMode.Create);
finalDocument.Save(outputStream);
// Close all documents
finalDocument.Close(true);
loadedDocument1.Close(true);
loadedDocument2.Close(true);
stream1.Close();
stream2.Close();
outputStream.Close();
}
}
// NuGet: Install-Package Syncfusion.Pdf.Net.Core
using Syncfusion.Pdf;
using Syncfusion.Pdf.Parsing;
using System.IO;
class Program
{
static void Main()
{
// Load the first PDF document
FileStream stream1 = new FileStream("Document1.pdf", FileMode.Open, FileAccess.Read);
PdfLoadedDocument loadedDocument1 = new PdfLoadedDocument(stream1);
// Load the second PDF document
FileStream stream2 = new FileStream("Document2.pdf", FileMode.Open, FileAccess.Read);
PdfLoadedDocument loadedDocument2 = new PdfLoadedDocument(stream2);
// Merge the documents
PdfDocument finalDocument = new PdfDocument();
finalDocument.ImportPageRange(loadedDocument1, 0, loadedDocument1.Pages.Count - 1);
finalDocument.ImportPageRange(loadedDocument2, 0, loadedDocument2.Pages.Count - 1);
// Save the merged document
FileStream outputStream = new FileStream("Merged.pdf", FileMode.Create);
finalDocument.Save(outputStream);
// Close all documents
finalDocument.Close(true);
loadedDocument1.Close(true);
loadedDocument2.Close(true);
stream1.Close();
stream2.Close();
outputStream.Close();
}
}
Imports Syncfusion.Pdf
Imports Syncfusion.Pdf.Parsing
Imports System.IO
Class Program
Shared Sub Main()
' Load the first PDF document
Dim stream1 As New FileStream("Document1.pdf", FileMode.Open, FileAccess.Read)
Dim loadedDocument1 As New PdfLoadedDocument(stream1)
' Load the second PDF document
Dim stream2 As New FileStream("Document2.pdf", FileMode.Open, FileAccess.Read)
Dim loadedDocument2 As New PdfLoadedDocument(stream2)
' Merge the documents
Dim finalDocument As New PdfDocument()
finalDocument.ImportPageRange(loadedDocument1, 0, loadedDocument1.Pages.Count - 1)
finalDocument.ImportPageRange(loadedDocument2, 0, loadedDocument2.Pages.Count - 1)
' Save the merged document
Dim outputStream As New FileStream("Merged.pdf", FileMode.Create)
finalDocument.Save(outputStream)
' Close all documents
finalDocument.Close(True)
loadedDocument1.Close(True)
loadedDocument2.Close(True)
stream1.Close()
stream2.Close()
outputStream.Close()
End Sub
End Class
Po (IronPDF):
// NuGet: Install-Package IronPdf
using IronPdf;
using System.Collections.Generic;
class Program
{
static void Main()
{
// Load PDF documents
var pdf1 = PdfDocument.FromFile("Document1.pdf");
var pdf2 = PdfDocument.FromFile("Document2.pdf");
// Merge PDFs
var merged = PdfDocument.Merge(new List<PdfDocument> { pdf1, pdf2 });
// Save the merged document
merged.SaveAs("Merged.pdf");
}
}
// NuGet: Install-Package IronPdf
using IronPdf;
using System.Collections.Generic;
class Program
{
static void Main()
{
// Load PDF documents
var pdf1 = PdfDocument.FromFile("Document1.pdf");
var pdf2 = PdfDocument.FromFile("Document2.pdf");
// Merge PDFs
var merged = PdfDocument.Merge(new List<PdfDocument> { pdf1, pdf2 });
// Save the merged document
merged.SaveAs("Merged.pdf");
}
}
Imports IronPdf
Imports System.Collections.Generic
Class Program
Shared Sub Main()
' Load PDF documents
Dim pdf1 = PdfDocument.FromFile("Document1.pdf")
Dim pdf2 = PdfDocument.FromFile("Document2.pdf")
' Merge PDFs
Dim merged = PdfDocument.Merge(New List(Of PdfDocument) From {pdf1, pdf2})
' Save the merged document
merged.SaveAs("Merged.pdf")
End Sub
End Class
Różnica w łączeniu plików PDF jest ogromna.Syncfusion PDFrequires creating FileStream objects for each input document, loading them as PdfLoadedDocument, creating a new PdfDocument, calling ImportPageRange() with start and end indices for each source, creating an output FileStream, and then closing six separate objects (finalDocument, loadedDocument1, loadedDocument2, stream1, stream2, outputStream).
IronPDF uses PdfDocument.FromFile() to load each PDF and a static PdfDocument.Merge() method that accepts a list of documents. Bez zarządzania strumieniem, bez ręcznego obliczania zakresu stron, bez wątpliwych przypadków.
Kluczowe różnice w filozofii API
Podejście oparte na współrzędnych a podejście "HTML/CSS-First"
Syncfusion PDF wykorzystuje model graficzny oparty na współrzędnych, odziedziczony po tradycyjnych bibliotekach PDF:
// Syncfusion: Podręcznik positioning
page.Graphics.DrawString("Text", font, PdfBrushes.Black, new PointF(100, 200));
page.Graphics.DrawRectangle(brush, new RectangleF(50, 50, 200, 100));
// Syncfusion: Podręcznik positioning
page.Graphics.DrawString("Text", font, PdfBrushes.Black, new PointF(100, 200));
page.Graphics.DrawRectangle(brush, new RectangleF(50, 50, 200, 100));
' Syncfusion: Podręcznik positioning
page.Graphics.DrawString("Text", font, PdfBrushes.Black, New PointF(100, 200))
page.Graphics.DrawRectangle(brush, New RectangleF(50, 50, 200, 100))
IronPDF wykorzystuje HTML/CSS do tworzenia układu:
// IronPDF: CSS-based positioning
var html = @"
<div style='margin: 50px; padding: 20px; border: 1px solid black;'>
<p style='color: black;'>Text</p>
</div>";
var pdf = renderer.RenderHtmlAsPdf(html);
// IronPDF: CSS-based positioning
var html = @"
<div style='margin: 50px; padding: 20px; border: 1px solid black;'>
<p style='color: black;'>Text</p>
</div>";
var pdf = renderer.RenderHtmlAsPdf(html);
' IronPDF: CSS-based positioning
Dim html As String = "
<div style='margin: 50px; padding: 20px; border: 1px solid black;'>
<p style='color: black;'>Text</p>
</div>"
Dim pdf = renderer.RenderHtmlAsPdf(html)
Podejście oparte na HTML/CSS jest bardziej intuicyjne dla programistów stron internetowych, łatwiejsze w utrzymaniu i zapewnia spójne wyniki na stronach o różnych rozmiarach.
Zarządzanie strumieniem a automatyczne czyszczenie
Syncfusion PDF wymaga jawnego usuwania strumieni i dokumentów:
// Syncfusion: Podręcznik cleanup
FileStream fileStream = new FileStream("Output.pdf", FileMode.Create);
document.Save(fileStream);
document.Close(true);
fileStream.Close();
// Syncfusion: Podręcznik cleanup
FileStream fileStream = new FileStream("Output.pdf", FileMode.Create);
document.Save(fileStream);
document.Close(true);
fileStream.Close();
' Syncfusion: Podręcznik cleanup
Dim fileStream As New FileStream("Output.pdf", FileMode.Create)
document.Save(fileStream)
document.Close(True)
fileStream.Close()
IronPDF automatycznie zajmuje się czyszczeniem:
// IronPDF: Automatyczne cleanup
pdf.SaveAs("Output.pdf");
// IronPDF: Automatyczne cleanup
pdf.SaveAs("Output.pdf");
Porównanie funkcji
| Funkcja | Syncfusion PDF | IronPDF |
|---|---|---|
| Zakup samodzielny | Nie (tylko Suite) | Tak |
| Licencjonowanie | Reklama z ograniczeniami dotyczącymi społeczności | Uproszczona wersja komercyjna |
| HTML do PDF | Wymaga BlinkBinaries | Natywny Chromium |
| Obsługa CSS3 | Ograniczone | Pełny (flexbox, grid) |
| Styl API | Grafika oparta na współrzędnych | HTML/CSS-najpierw |
| Zarządzanie strumieniami | Podręcznik | Automatyczne |
| Zależności | Wiele pakietów | Pojedynczy NuGet |
| Złożoność wdrożenia | Potencjalnie złożone | Proste |
Lista kontrolna migracji
Przed migracją
- Sporządź spis wszystkich miejsc użyciaSyncfusion PDFw kodzie źródłowym
- Koszty licencji na dokumenty i wymagania dotyczące wdrożenia
- Identify
PdfGrid,PdfGraphics, andHtmlToPdfConverterusages - Uzyskaj klucz licencyjnyIronPDFze strony ironpdf.com
Aktualizacje kodu
- RemoveSyncfusionpackages (
Syncfusion.Pdf.Net.Core,Syncfusion.HtmlToPdfConverter.Net.Windows,Syncfusion.Licensing) - Install
IronPdfNuGet package - Update namespace imports (
using Syncfusion.Pdf;→using IronPdf;) - Replace
Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense()withIronPdf.License.LicenseKey = "..." - Replace
HtmlToPdfConverter.Convert()withChromePdfRenderer.RenderUrlAsPdf()orRenderHtmlAsPdf() - Replace
PdfDocument+Pages.Add()+Graphics.DrawString()withChromePdfRenderer.RenderHtmlAsPdf() - Replace
PdfLoadedDocumentwithPdfDocument.FromFile() - Replace
ImportPageRange()withPdfDocument.Merge() - Replace
document.Save(stream)withpdf.SaveAs(path) - Remove all
document.Close(true)andstream.Close()calls - Replace
PdfGridwith HTML<table>elements - Replace
PdfStandardFontwith CSSfont-family - Replace
PdfBrusheswith CSScolorproperties
Testowanie
- Wizualne porównanie pliku PDF
- Sprawdź ulepszenia w renderowaniu CSS (flexbox i grid już działają)
- Wyodrębnianie tekstu testowego
- Testowanie łączenia i dzielenia
- Porównanie wydajności

