C# ile iTextSharp Kullanarak PDF'e Dijital İmza Nasıl Eklenir | IronPDF
Syncfusion PDF Çerçevesi'nden IronPDF'e geçmek, PDF oluşturma iş akışınızı bir koordinat tabanlı grafik API'si ile geniş bir pakete dahil edilmiş bir yerden, modern Chromium işleme ile bağımsız bir, HTML/CSS-öncelikli bir kütüphaneye dönüştürür. Bu kılavuz, yalnızca paket lisanslamasını, karmaşık dağıtım gereksinimlerini ve koordinat tabanlı konumlandırmayı ortadan kaldıran bir adım adım geçiş yolu sunar.
Syncfusion PDF'den IronPDF'e Neden Geçilmelidir
Syncfusion PDF Çerçevesini Anlamak
Syncfusion PDF Çerçevesi, C# kullanarak PDF belgeleri oluşturma, düzenleme ve güvence altına alma için geniş bir yelpazede işlevsellik sağlayan kapsamlı bir kütüphanedir. Syncfusion'un Essential Studio'sunun bir parçası olarak gelir ve birden fazla platformda binden fazla bileşeni içerir.
PDF kütüphanesi tek bir bileşen olarak satın alınamaz. Syncfusion, artık UI bileşenleri olmadan PDF, Word, Excel ve PowerPoint kütüphanelerini içeren bir 'Belge SDK' paketi ve tam Essential Studio paketi ile birlikte sunuyor. Sadece PDF işlevselliğine ihtiyaç duyan ekipler, minimumda Belge SDK'nın alınması gerekir, bu da diğer belge kütüphaneleri kullanılmadığında zahmetli olabilir.
Paket Lisanslama Sorunu
Syncfusion'un lisanslama modeli, yalnızca PDF işlevselliğine ihtiyaç duyan ekipler için önemli zorluklar yaratır:
- Kütüphane Başına Satın Alma Yok: PDF, Belge SDK'ya (PDF + Word + Excel + PowerPoint) veya tam Essential Studio'ya dahil edilmiştir — tek başına lisanslanamaz
- Topluluk Lisans Sınırlamaları: Ücretsiz katman, yıllık gelir <$1M, ≤5 geliştirici ve ≤10 toplam çalışan, artı $3M ömür boyu dış sermaye sınırı gerektirir
- Karmaşık Dağıtım Lisanslaması: Web, masaüstü, sunucu dağıtımları için farklı lisanslar
- Yıllık Yenileme Gereklidir: Yıllık maliyetleri olan abonelik modeli (minimum 1 yıl süre)
- Geliştirici Başına Fiyatlandırma: Maliyetler ekip büyüklüğüne göre doğrusal olarak ölçeklenir
- Paket Şişkinliği: Belge SDK, sadece PDF'e ihtiyacınız olduğunda bile Word/Excel/PowerPoint bağımlılıklarını içeri çekiyor; tam Essential Studio üzerine 1000+ UI bileşeni ekler
Syncfusion PDF ve IronPDF Karşılaştırması
| Aspekt | Syncfusion PDF | IronPDF |
|---|---|---|
| Satın Alma Modeli | Belge SDK paketi veya tam Essential Studio (kütüphane başına SKU yok) | Tek başına |
| Lisanslama | Karmaşık katmanlar | Basit geliştirici başına |
| Topluluk Sınırı | <$1M revenue, ≤5 devs, ≤10 employees, ≤$3M outside capital | Ücretsiz deneme, ardından lisans |
| Dağıtım | Birden fazla lisans türü | Tek lisans hepsini kapsar |
| API Stili | Koordinat tabanlı grafikler + HTML dönüştürücü | HTML/CSS-öncelikli |
| HTML Motoru | Blink (ayrı Windows/Linux/Mac NuGet paketleri) | Paketlenmiş Chromium |
| CSS Desteği | Modern (Blink) — Chromium ile neredeyse aynı | Tam CSS3 / flexbox / grid |
| Bağımlılıklar | Birden fazla paket | Tek NuGet |
| Paket Zorunluluğu | Evet (Belge SDK veya Essential Studio) | Hayır |
| PDF Üzerine Odaklanma | Geniş; daha büyük bir paketin parçası | Dar; PDF üzerine odaklanılmış |
IronPDF, PDF yeteneklerini bağımsız bir ürün olarak sunarak daha odaklı bir yaklaşım sunar. Bu fark, hem maliyet değerlendirmelerini hem de entegrasyon kolaylığını önemli ölçüde etkiler.
Modern .NET'i benimseyen ekipler için, IronPDF'nin bağımsız lisanslaması ve HTML/CSS-ilk yaklaşımı, paket bağımlılıkları olmadan esneklik sağlar.
Başlamadan Önce
Ön Koşullar
- .NET Ortamı: .NET Framework 4.6.2+ veya .NET Core 3.1+ / .NET 5/6/7/8/9+
- NuGet Erişimi: NuGet paketlerini yükleyebilme
- IronPDF Lisansı: Lisans anahtarınızı ironpdf.com adresinden edinin
NuGet Paket Değişiklikleri
# Remove Syncfusion packages
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
Lisans Yapılandırması
Syncfusion:
// 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-LICENSE-KEY";' One-time at startup
IronPdf.License.LicenseKey = "YOUR-LICENSE-KEY"Tam API Referansı
Ad Alanı Değişiklikleri
// 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.RenderingTemel API Eşlemeleri
| Syncfusion | IronPDF |
|---|---|
PdfDocument | ChromePdfRenderer |
PdfLoadedDocument | PdfDocument.FromFile() |
HtmlToPdfConverter | ChromePdfRenderer |
graphics.DrawString() | HTML metin öğeleri |
graphics.DrawImage() | <img> etiketi |
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) | Gerekli değil |
Kod Göç Örnekleri
Örnek 1: HTML/URL'den PDF'e Dönüştürme
Önceki (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
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 ModuleSonrası (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
Imports IronPdf
Module Program
Sub Main()
' Create a PDF from a URL
Dim renderer As New ChromePdfRenderer()
Dim pdf = renderer.RenderUrlAsPdf("https://www.example.com")
' Save the PDF
pdf.SaveAs("Output.pdf")
End Sub
End ModuleBu örnek, temel API farklarını göstermektedir.Syncfusion PDFbir HtmlToPdfConverter örneği gerektirir, bir Convert() çağırır ve sonra bir PdfDocument döndüren, ardından FileStream'u manuel olarak oluşturur, belgeyi ve akışı kaydedip kapatır.
IronPDF, sadece üç satır kodla, ChromePdfRenderer ile RenderUrlAsPdf() kullanır. Hiçbir FileStream yönetimi, hiçbir Close() çağrısı yok –IronPDF temizliği otomatik olarak halleder. Kapsamlı örnekler için HTML'den PDF'e dönüşüm belgelerine bakın.
Örnek 2: Metinden PDF Oluşturma
Önceki (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
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 ModuleSonrası (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
Imports IronPdf
Imports IronPdf.Rendering
Module Program
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 ModuleSyncfusion PDF bir koordinat tabanlı grafik modeli kullanır. Bir PdfDocument oluşturursunuz, bir PdfPage eklersiniz, PdfFontFamily.Helvetica ile bir PdfFont oluşturur ve sonra page.Graphics.DrawString()'u açık koordinatlar (new PointF(10, 10)), yazı tipi ve fırça (PdfBrushes.Black) ile çağırırsınız. Son olarak, FileStream oluşturmayı ve yok etmeyi yönetirsiniz.
IronPDF, HTML/CSS-öncelikli bir yaklaşım kullanır. Instead of coordinates, you write <h1>Hello, World!</h1> and let CSS handle positioning, fonts, and colors. Bu yaklaşım, daha basit, daha sürdürülebilir bir çözüm sunar ve geliştiricilerin zaten sahip oldukları becerileri kullanır. Daha fazla bilgiyi kılavuzlarımızda öğrenin.
Örnek 3: PDF Belgelerini Birleştirme
Önceki (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
Imports Syncfusion.Pdf
Imports Syncfusion.Pdf.Parsing
Imports System.IO
Module Program
Sub Main()
' Load the first PDF document
Dim stream1 As FileStream = New FileStream("Document1.pdf", FileMode.Open, FileAccess.Read)
Dim loadedDocument1 As PdfLoadedDocument = New PdfLoadedDocument(stream1)
' Load the second PDF document
Dim stream2 As FileStream = New FileStream("Document2.pdf", FileMode.Open, FileAccess.Read)
Dim loadedDocument2 As PdfLoadedDocument = New PdfLoadedDocument(stream2)
' Merge the documents
Dim finalDocument As PdfDocument = 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 FileStream = 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 ModuleSonrası (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
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 ClassPDF'lerin birleştirilmesi arasındaki fark çarpıcıdır.Syncfusion PDFher bir giriş belgesi için FileStream nesneleri oluşturmayı, bunları PdfLoadedDocument olarak yüklemeyi, yeni bir PdfDocument oluşturmayı, her kaynak için başlangıç ve bitiş indeksleriyle ImportPageRange() çağırmayı, bir çıktı FileStream oluşturmayı ve ardından altı ayrı nesneyi kapatmayı (finalDocument, loadedDocument1, loadedDocument2, stream1, stream2, outputStream) gerektirir.
IronPDF her PDF'i yüklemek için PdfDocument.FromFile() kullanır ve bir belge listesini kabul eden sabit bir PdfDocument.Merge() yöntemi vardır. Akış yönetimi yok, manuel sayfa aralığı hesaplamaları yok, kapatma çağrıları yok.
API Felsefesindeki Temel Farklar
Koordinat Tabanlı vs HTML/CSS-Öncelikli
Syncfusion PDF, geleneksel PDF kütüphanelerinden miras alınan bir koordinat tabanlı grafik modeli kullanır:
// Syncfusion:Yönergepositioning
page.Graphics.DrawString("Text", font, PdfBrushes.Black, new PointF(100, 200));
page.Graphics.DrawRectangle(brush, new RectangleF(50, 50, 200, 100));
IronPDF, düzen için HTML/CSS kullanır:
// 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)HTML/CSS yaklaşımı, web geliştiricileri için daha sezgiseldir, sürdürülmesi daha kolaydır ve farklı sayfa boyutları arasında tutarlı sonuçlar üretir.
Akış Yönetimi vs Otomatik Temizlik
Syncfusion PDF, açık akış ve belge elden çıkarmayı gerektirir:
// Syncfusion:Yönergecleanup
FileStream fileStream = new FileStream("Output.pdf", FileMode.Create);
document.Save(fileStream);
document.Close(true);
fileStream.Close();
IronPDF otomatik temizlik işlemlerini yapar:
// IronPDF:Otomatikcleanup
pdf.SaveAs("Output.pdf");netÖzellik Karşılaştırması
| Özellik | Syncfusion PDF | IronPDF |
|---|---|---|
| Bağımsız Satın Alma | Hayır (Belge SDK veya Essential Studio) | Evet |
| Lisanslama | Topluluk kısıtlamalı ticari | Basitleştirilmiş ticari |
| HTML Motoru | Blink (platforma özgü NuGets) | Paketlenmiş Chromium |
| CSS3 Desteği | Blink üzerinden modern | Tam (flexbox, grid) |
| API Stili | Koordinat tabanlı grafikler + HTML dönüştürücü | HTML/CSS-öncelikli |
| Akış Yönetimi | Yönerge | Otomatik |
| Bağımlılıklar | Birden fazla paket | Tek NuGet |
| Dağıtım Karmaşıklığı | Potansiyel olarak karmaşık | Kolay |
Geçiş Kontrol Listesi
Öncesi-Geçiş
- Kod tabanındaki tümSyncfusion PDFkullanımlarını envanterleyin
- Lisans maliyetlerini ve dağıtım gereksinimlerini belgeleyin
PdfGrid,PdfGraphicsveHtmlToPdfConverterkullanımlarını tanımlayın- ironpdf.com adresinden IronPDF lisans anahtarını edinin
Kod Güncellemeleri
-Syncfusionpaketlerini kaldırın (Syncfusion.Pdf.Net.Core, Syncfusion.HtmlToPdfConverter.Net.Windows, Syncfusion.Licensing)
IronPdfNuGet paketini kurun- Ad alanı ithalatlarını güncelleyin (
using Syncfusion.Pdf;→using IronPdf;) Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense()'yıIronPdf.License.LicenseKey = "..."ile değiştirinHtmlToPdfConverter.Convert()'yıChromePdfRenderer.RenderUrlAsPdf()veyaRenderHtmlAsPdf()ile değiştirinPdfDocument+Pages.Add()+Graphics.DrawString()'yiChromePdfRenderer.RenderHtmlAsPdf()ile değiştirinPdfLoadedDocument'yiPdfDocument.FromFile()ile değiştirinImportPageRange()'yiPdfDocument.Merge()ile değiştirindocument.Save(stream)'yıpdf.SaveAs(path)ile değiştirin- Tüm
document.Close(true)vestream.Close()çağrılarını kaldırın PdfGrid'yı HTML<table>öğeleriyle değiştirinPdfStandardFont'yiCSSfont-familyile değiştirinPdfBrushes'yi CSScolorözellikleriyle değiştirin
Test Etme
- PDF çıktısının görsel karşılaştırması
- CSS render iyileştirmelerini doğrula (flexbox, grid artık çalışıyor)
- Metin çıkarma işlemini test et
- Birleştirme ve ayırma işlemlerini test et
- Performans karşılaştırması

Curtis Chau, Bilgisayar Bilimleri alanında Lisans Derecesine (Carleton Üniversitesi) sahip ve Node.js, TypeScript, JavaScript ve React konularında uzmanlaşmış ön uç geliştirmeyle ilgileniyor. Sezgisel ve estetik açıdan hoş kullanıcı arayüzleri oluşturma tutkunu, Curtis modern çerçevelerle çalışmayı ve iyi yapılandırılmış, görsel olarak çekici kılavuzlar oluşturmayı seviyor.