GemBox PDF'den IronPDF'e C# ile Nasıl Geçilir
GemBox PDF'den IronPDF'ye geçiş, .NET PDF iş akışınızı koordinat tabanlı, programatik belge oluşturumundan modern HTML/CSS tabanlı dokuşumuna dönüştürür. Bu kılavuz, paragraf limitlerini ortadan kaldıran ve .NET profesyonel geliştiricileri için belge oluşturumunu basitleştiren kapsamlı, adım adım bir geçiş yolu sunar.
GemBox PDF'den IronPDF'ye Neden Geçmelisiniz?
GemBox PDFZorlukları
GemBox PDF yetenekli bir .NET PDF bileşenidir, ancak gerçek dünya geliştirmesini etkileyen önemli sınırlamaları vardır:
-
Ücretsiz Versiyondaki 20 Paragraf Limiti: Ücretsiz sürüm, sizi 20 paragrafla sınırlı tutar ve tablo hücreleri bu limite dahil edilir. Basit bir 10 satır, 5 sütun tablo 50 "paragraf" kullanır, bu da ücretsiz sürümü temel iş belgelerinde kullanılmaz hale getirir.
-
HTML'den PDF'e Dönüşüm Yok:GemBox PDFprogramatik belge oluşturumu gerektirir. Koordinatları hesaplamalı ve her öğeyi manuel olarak konumlandırmalısınız—sadece "bu HTML'yi dokuştur" gibi bir yeteneğiniz yok.
-
Koordinat Tabanlı Yerleşim: HTML/CSS'de yerleşim doğal olarak akarken,GemBox PDFher metin öğesi, resim ve şekil için X/Y pozisyonlarını kesin olarak hesaplamanızı gerektirir.
-
Sınırlı Özellik Seti: Kapsamlı PDF kütüphaneleri ile karşılaştırıldığında,GemBox PDFtemel işlemlere—okuma, yazma, birleştirme, bölme—odaklanır ve gelişmiş özellikler sunmaz.
-
Sadece Programatik: Her tasarım değişikliği kod değişikliklerini gerektirir. Boşlukları ayarlamak mı istiyorsunuz? Koordinatları yeniden hesaplayın. Farklı bir yazı tipi boyutu mu istiyorsunuz? Altındaki tüm Y pozisyonlarını ayarlayın.
-
Tablo Hücresi Sayımı: Paragraf limiti sadece görünen paragrafları değil, tablo hücrelerini de sayar. Bu da ücretsiz versiyonu tablolara sahip belgeler için neredeyse değersiz yapar.
- Tasarım için Öğrenme Eğrisi: Geliştiriciler belge akışı yerine koordinatlar düşünmelidir, bu da "bir paragraf ekle" gibi basit görevleri şaşırtıcı derecede karmaşık hale getirir.
GemBox PDF vsIronPDFKarşılaştırması
| Bağlam | GemBox PDF | IronPDF |
|---|---|---|
| Ücretsiz Versiyon Sınırlamaları | 20 paragraf (tablo hücrelerini içerir) | Yalnızca filigran, içerik sınırı yok |
| HTML'den PDF'e | Desteklenmiyor | Tam Chromium motoru |
| Yerleşim Yaklaşımı | Koordinat tabanlı, elle | HTML/CSS akış düzeni |
| Tablolar | Paragraf sınırına dahil edilir | Sınırsız, HTML tabloları kullanın |
| Modern CSS | Geçerli değil | Flexbox, Grid, CSS3 animasyonları |
| JavaScript Support | Geçerli değil | Tam JavaScript çalıştırma |
| Tasarım Değişiklikleri | Koordinatları yeniden hesaplayın | HTML/CSS'i düzenleyin |
| Öğrenme Eğrisi | PDF koordinat sistemi | HTML/CSS (web tanıdık) |
2025 ve 2026 boyunca .NET 10 ve C# 14 benimsemeyi planlayan ekipler için,IronPDFPDF üretimi için tanıdık web teknolojilerini kullanarak gelecek uyumlu bir temel sağlar.
Göç Karmaşıklık Değerlendirmesi
Özelliklere Göre Tahmini Çaba
| Özellik | Göç Karmaşıklığı |
|---|---|
| PDF'leri Yükle/Kaydet | Çok Düşük |
| PDF'leri birleştir | Çok Düşük |
| PDF'leri Böl | Low |
| Metin Çıkarma | Çok Düşük |
| Metin Ekle | Medium |
| Tablolar | Low |
| Resimler | Low |
| Filigranlar | Low |
| Şifre Koruması | Medium |
| Form Alanları | Medium |
Paradigma Değişikliği
BuGemBox PDFgeçişindeki en büyük değişiklik, koordinat tabanlı yerleşimden HTML/CSS yerleşimine geçiştir:
GemBox PDF: "Metni (100, 700) konumuna çiz"
IronPDF: "Bu HTML'i CSS stillendirmesiyle işler"
Bu paradigma değişikliği, web teknolojilerini bilen geliştiriciler için genellikle daha kolaydır, ancak PDF'leri farklı düşünmeyi gerektirir.
Başlamadan Önce
Önkoşullar
- .NET Sürümü: IronPDF, .NET Framework 4.6.2+ ve .NET Core 2.0+ / .NET 5/6/7/8/9+ destekler
- Lisans Anahtarı:IronPDFlisans anahtarınızı ironpdf.com'dan alın
- Yedekleme: Geçiş çalışması için bir dal oluşturun
- HTML/CSS Bilgisi: Temel aşinalık yararlıdır ancak gerekli değildir
TümGemBox PDFKullanımını Belirleyin
# Find allGemBox PDFreferences
grep -r "GemBox\.Pdf\|PdfDocument\|PdfPage\|PdfFormattedText\|ComponentInfo\.SetLicense" --include="*.cs" .
# Find package references
grep -r "GemBox\.Pdf" --include="*.csproj" .
# Find allGemBox PDFreferences
grep -r "GemBox\.Pdf\|PdfDocument\|PdfPage\|PdfFormattedText\|ComponentInfo\.SetLicense" --include="*.cs" .
# Find package references
grep -r "GemBox\.Pdf" --include="*.csproj" .
NuGet Paket Değişiklikleri
# Remove GemBox PDF
dotnet remove package GemBox.Pdf
# Install IronPDF
dotnet add package IronPdf
# Remove GemBox PDF
dotnet remove package GemBox.Pdf
# Install IronPDF
dotnet add package IronPdf
Hızlı Başlangıç Göçü
Adım 1: Lisans Yapılandırmasını Güncelleyin
Önce (GemBox PDF):
// Must call before anyGemBox PDFoperations
ComponentInfo.SetLicense("FREE-LIMITED-KEY");
// Or for professional:
ComponentInfo.SetLicense("YOUR-PROFESSIONAL-LICENSE");
// Must call before anyGemBox PDFoperations
ComponentInfo.SetLicense("FREE-LIMITED-KEY");
// Or for professional:
ComponentInfo.SetLicense("YOUR-PROFESSIONAL-LICENSE");
' Must call before any GemBox PDF operations
ComponentInfo.SetLicense("FREE-LIMITED-KEY")
' Or for professional:
ComponentInfo.SetLicense("YOUR-PROFESSIONAL-LICENSE")
Sonra (IronPDF):
// Set once at application startup
IronPdf.License.LicenseKey = "YOUR-IRONPDF-LICENSE-KEY";
// Or in appsettings.json:
// { "IronPdf.License.LicenseKey": "YOUR-LICENSE-KEY" }
// Set once at application startup
IronPdf.License.LicenseKey = "YOUR-IRONPDF-LICENSE-KEY";
// Or in appsettings.json:
// { "IronPdf.License.LicenseKey": "YOUR-LICENSE-KEY" }
' Set once at application startup
IronPdf.License.LicenseKey = "YOUR-IRONPDF-LICENSE-KEY"
' Or in appsettings.json:
' { "IronPdf.License.LicenseKey": "YOUR-LICENSE-KEY" }
Adım 2: Ad Alanı Dışarı Aktarımlarını Güncelleyin
// Before (GemBox PDF)
using GemBox.Pdf;
using GemBox.Pdf.Content;
// After (IronPDF)
using IronPdf;
using IronPdf.Editing;
// Before (GemBox PDF)
using GemBox.Pdf;
using GemBox.Pdf.Content;
// After (IronPDF)
using IronPdf;
using IronPdf.Editing;
Imports IronPdf
Imports IronPdf.Editing
Adım 3: Temel Dönüşüm Deseni
Önce (GemBox PDF):
using GemBox.Pdf;
using GemBox.Pdf.Content;
ComponentInfo.SetLicense("FREE-LIMITED-KEY");
using (var document = new PdfDocument())
{
var page = document.Pages.Add();
var formattedText = new PdfFormattedText()
{
Text = "Hello World",
FontSize = 24
};
page.Content.DrawText(formattedText, new PdfPoint(100, 700));
document.Save("output.pdf");
}
using GemBox.Pdf;
using GemBox.Pdf.Content;
ComponentInfo.SetLicense("FREE-LIMITED-KEY");
using (var document = new PdfDocument())
{
var page = document.Pages.Add();
var formattedText = new PdfFormattedText()
{
Text = "Hello World",
FontSize = 24
};
page.Content.DrawText(formattedText, new PdfPoint(100, 700));
document.Save("output.pdf");
}
Imports GemBox.Pdf
Imports GemBox.Pdf.Content
ComponentInfo.SetLicense("FREE-LIMITED-KEY")
Using document As New PdfDocument()
Dim page = document.Pages.Add()
Dim formattedText As New PdfFormattedText() With {
.Text = "Hello World",
.FontSize = 24
}
page.Content.DrawText(formattedText, New PdfPoint(100, 700))
document.Save("output.pdf")
End Using
Sonra (IronPDF):
using IronPdf;
IronPdf.License.LicenseKey = "YOUR-LICENSE-KEY";
var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderHtmlAsPdf("<h1 style='font-size:24px;'>Hello World</h1>");
pdf.SaveAs("output.pdf");
using IronPdf;
IronPdf.License.LicenseKey = "YOUR-LICENSE-KEY";
var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderHtmlAsPdf("<h1 style='font-size:24px;'>Hello World</h1>");
pdf.SaveAs("output.pdf");
Imports IronPdf
IronPdf.License.LicenseKey = "YOUR-LICENSE-KEY"
Dim renderer As New ChromePdfRenderer()
Dim pdf = renderer.RenderHtmlAsPdf("<h1 style='font-size:24px;'>Hello World</h1>")
pdf.SaveAs("output.pdf")
Temel Farkliilar:
- Koordinat hesaplamalarına gerek yok
- Programatik yerleşim yerine HTML/CSS
- Paragraf sınırı yok
- Daha basit, daha okunabilir kod
API Referansının Tamamı
Namespace Eşleme
| GemBox PDF | IronPDF |
|---|---|
GemBox.Pdf |
IronPdf |
GemBox.Pdf.Content |
IronPdf (içerik HTML'dir) |
GemBox.Pdf.Security |
IronPdf (SecuritySettings) |
GemBox.Pdf.Forms |
IronPdf.Forms |
Çekirdek Sınıf Eşleştirmesi
| GemBox PDF | IronPDF | Tanım |
|---|---|---|
PdfDocument |
PdfDocument |
Ana PDF belge sınıfı |
PdfPage |
PdfDocument.Pages[i] |
Sayfa temsili |
PdfContent |
N/A (HTML kullanın) | Sayfa içeriği |
PdfFormattedText |
N/A (HTML kullanın) | Biçimlendirilmiş metin |
PdfPoint |
N/A (CSS konumlandırma kullanın) | Koordinat konumlandırma |
ComponentInfo.SetLicense() |
IronPdf.License.LicenseKey |
Lisans yönetimi |
Belge İşlemleri
| GemBox PDF | IronPDF |
|---|---|
new PdfDocument() |
new PdfDocument() |
PdfDocument.Load(path) |
PdfDocument.FromFile(path) |
PdfDocument.Load(stream) |
PdfDocument.FromStream(stream) |
document.Save(path) |
pdf.SaveAs(path) |
document.Save(stream) |
pdf.Stream veya pdf.BinaryData |
Sayfa İşlemleri
| GemBox PDF | IronPDF |
|---|---|
document.Pages.Add() |
HTML işleme ile oluşturun |
document.Pages.Count |
pdf.PageCount |
document.Pages[index] |
pdf.Pages[index] |
document.Pages.AddClone(pages) |
PdfDocument.Merge() |
Metin ve İçerik İşlemleri
| GemBox PDF | IronPDF |
|---|---|
new PdfFormattedText() |
HTML dizesi |
formattedText.FontSize = 12 |
CSS font-size: 12pt |
formattedText.Font = ... |
CSS font-family: ... |
page.Content.DrawText(text, point) |
renderer.RenderHtmlAsPdf(html) |
page.Content.GetText() |
pdf.ExtractTextFromPage(i) |
Kod Geçiş Örnekleri
Örnek 1: HTML'den PDF'e Dönüştürme
Önce (GemBox PDF):
// NuGet: Install-Package GemBox.Pdf
using GemBox.Pdf;
using GemBox.Pdf.Content;
class Program
{
static void Main()
{
ComponentInfo.SetLicense("FREE-LIMITED-KEY");
var document = PdfDocument.Load("input.html");
document.Save("output.pdf");
}
}
// NuGet: Install-Package GemBox.Pdf
using GemBox.Pdf;
using GemBox.Pdf.Content;
class Program
{
static void Main()
{
ComponentInfo.SetLicense("FREE-LIMITED-KEY");
var document = PdfDocument.Load("input.html");
document.Save("output.pdf");
}
}
Imports GemBox.Pdf
Imports GemBox.Pdf.Content
Module Program
Sub Main()
ComponentInfo.SetLicense("FREE-LIMITED-KEY")
Dim document = PdfDocument.Load("input.html")
document.Save("output.pdf")
End Sub
End Module
Sonra (IronPDF):
// NuGet: Install-Package IronPdf
using IronPdf;
class Program
{
static void Main()
{
var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderHtmlAsPdf("<h1>Hello World</h1>");
pdf.SaveAs("output.pdf");
}
}
// NuGet: Install-Package IronPdf
using IronPdf;
class Program
{
static void Main()
{
var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderHtmlAsPdf("<h1>Hello World</h1>");
pdf.SaveAs("output.pdf");
}
}
Imports IronPdf
Class Program
Shared Sub Main()
Dim renderer = New ChromePdfRenderer()
Dim pdf = renderer.RenderHtmlAsPdf("<h1>Hello World</h1>")
pdf.SaveAs("output.pdf")
End Sub
End Class
IronPDF, dogru HTML/CSS/JavaScript işleme için modern bir Chromium motoru kullanan ChromePdfRenderer sınıfını kullanır. GemBox PDF'nin sınırlı HTML desteğine karşılık,IronPDFtüm HTML içeriğini tam CSS3 ve JavaScript desteği ile işleyebilir. Daha fazla işleme seçeneği için HTML'yi PDF'e dönüştürme belgelerine bakın.
Örnek 2: PDF Dosyalarını Birleştirme
Önce (GemBox PDF):
// NuGet: Install-Package GemBox.Pdf
using GemBox.Pdf;
using System.Linq;
class Program
{
static void Main()
{
ComponentInfo.SetLicense("FREE-LIMITED-KEY");
using (var document = new PdfDocument())
{
var source1 = PdfDocument.Load("document1.pdf");
var source2 = PdfDocument.Load("document2.pdf");
document.Pages.AddClone(source1.Pages);
document.Pages.AddClone(source2.Pages);
document.Save("merged.pdf");
}
}
}
// NuGet: Install-Package GemBox.Pdf
using GemBox.Pdf;
using System.Linq;
class Program
{
static void Main()
{
ComponentInfo.SetLicense("FREE-LIMITED-KEY");
using (var document = new PdfDocument())
{
var source1 = PdfDocument.Load("document1.pdf");
var source2 = PdfDocument.Load("document2.pdf");
document.Pages.AddClone(source1.Pages);
document.Pages.AddClone(source2.Pages);
document.Save("merged.pdf");
}
}
}
Imports GemBox.Pdf
Imports System.Linq
Module Program
Sub Main()
ComponentInfo.SetLicense("FREE-LIMITED-KEY")
Using document As New PdfDocument()
Dim source1 = PdfDocument.Load("document1.pdf")
Dim source2 = PdfDocument.Load("document2.pdf")
document.Pages.AddClone(source1.Pages)
document.Pages.AddClone(source2.Pages)
document.Save("merged.pdf")
End Using
End Sub
End Module
Sonra (IronPDF):
// NuGet: Install-Package IronPdf
using IronPdf;
class Program
{
static void Main()
{
var pdf1 = PdfDocument.FromFile("document1.pdf");
var pdf2 = PdfDocument.FromFile("document2.pdf");
var merged = PdfDocument.Merge(pdf1, pdf2);
merged.SaveAs("merged.pdf");
}
}
// NuGet: Install-Package IronPdf
using IronPdf;
class Program
{
static void Main()
{
var pdf1 = PdfDocument.FromFile("document1.pdf");
var pdf2 = PdfDocument.FromFile("document2.pdf");
var merged = PdfDocument.Merge(pdf1, pdf2);
merged.SaveAs("merged.pdf");
}
}
Imports IronPdf
Class Program
Shared Sub Main()
Dim pdf1 = PdfDocument.FromFile("document1.pdf")
Dim pdf2 = PdfDocument.FromFile("document2.pdf")
Dim merged = PdfDocument.Merge(pdf1, pdf2)
merged.SaveAs("merged.pdf")
End Sub
End Class
IronPDF'un statik Merge yöntemi işlemi basitlestirir—bos bir belge oluşturup sayfaları tek tek klonlamaniza gerek yoktur. PDF'leri birleştirme ve bölme hakkında daha fazla bilgi edinin.
Örnek 3: PDF'ye Metin Ekleme
Önce (GemBox PDF):
// NuGet: Install-Package GemBox.Pdf
using GemBox.Pdf;
using GemBox.Pdf.Content;
class Program
{
static void Main()
{
ComponentInfo.SetLicense("FREE-LIMITED-KEY");
using (var document = new PdfDocument())
{
var page = document.Pages.Add();
var formattedText = new PdfFormattedText()
{
Text = "Hello World",
FontSize = 24
};
page.Content.DrawText(formattedText, new PdfPoint(100, 700));
document.Save("output.pdf");
}
}
}
// NuGet: Install-Package GemBox.Pdf
using GemBox.Pdf;
using GemBox.Pdf.Content;
class Program
{
static void Main()
{
ComponentInfo.SetLicense("FREE-LIMITED-KEY");
using (var document = new PdfDocument())
{
var page = document.Pages.Add();
var formattedText = new PdfFormattedText()
{
Text = "Hello World",
FontSize = 24
};
page.Content.DrawText(formattedText, new PdfPoint(100, 700));
document.Save("output.pdf");
}
}
}
Imports GemBox.Pdf
Imports GemBox.Pdf.Content
Module Program
Sub Main()
ComponentInfo.SetLicense("FREE-LIMITED-KEY")
Using document As New PdfDocument()
Dim page = document.Pages.Add()
Dim formattedText As New PdfFormattedText() With {
.Text = "Hello World",
.FontSize = 24
}
page.Content.DrawText(formattedText, New PdfPoint(100, 700))
document.Save("output.pdf")
End Using
End Sub
End Module
Sonra (IronPDF):
// NuGet: Install-Package IronPdf
using IronPdf;
using IronPdf.Editing;
class Program
{
static void Main()
{
var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderHtmlAsPdf("<p>Original Content</p>");
var stamper = new TextStamper()
{
Text = "Hello World",
FontSize = 24,
HorizontalOffset = 100,
VerticalOffset = 700
};
pdf.ApplyStamp(stamper);
pdf.SaveAs("output.pdf");
}
}
// NuGet: Install-Package IronPdf
using IronPdf;
using IronPdf.Editing;
class Program
{
static void Main()
{
var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderHtmlAsPdf("<p>Original Content</p>");
var stamper = new TextStamper()
{
Text = "Hello World",
FontSize = 24,
HorizontalOffset = 100,
VerticalOffset = 700
};
pdf.ApplyStamp(stamper);
pdf.SaveAs("output.pdf");
}
}
Imports IronPdf
Imports IronPdf.Editing
Class Program
Shared Sub Main()
Dim renderer = New ChromePdfRenderer()
Dim pdf = renderer.RenderHtmlAsPdf("<p>Original Content</p>")
Dim stamper = New TextStamper() With {
.Text = "Hello World",
.FontSize = 24,
.HorizontalOffset = 100,
.VerticalOffset = 700
}
pdf.ApplyStamp(stamper)
pdf.SaveAs("output.pdf")
End Sub
End Class
Mevcut PDF'lere metin eklemek icin, IronPDF, kesin konum kontrolu sunan TextStamper sınıfını sağlar. Yeni belgeler için metni sadece HTML şablonunuza ekleyin. Ek seçenekler için damga belgelerine bakın.
Örnek 4: Tablolar Oluşturma (En Büyük Gelişme!)
Önce (GemBox PDF) - Her hücre 20-paragraf sınırına sayılır:
using GemBox.Pdf;
using GemBox.Pdf.Content;
ComponentInfo.SetLicense("FREE-LIMITED-KEY");
using (var document = new PdfDocument())
{
var page = document.Pages.Add();
double y = 700;
double[] xPositions = { 50, 200, 300, 400 };
// Headers (4 paragraphs)
var headers = new[] { "Product", "Price", "Qty", "Total" };
for (int i = 0; i < headers.Length; i++)
{
var text = new PdfFormattedText { Text = headers[i], FontSize = 12 };
page.Content.DrawText(text, new PdfPoint(xPositions[i], y));
}
y -= 20;
// Data rows (4 paragraphs per row!)
// Can only add a few rows before hitting 20-paragraph limit!
document.Save("products.pdf");
}
using GemBox.Pdf;
using GemBox.Pdf.Content;
ComponentInfo.SetLicense("FREE-LIMITED-KEY");
using (var document = new PdfDocument())
{
var page = document.Pages.Add();
double y = 700;
double[] xPositions = { 50, 200, 300, 400 };
// Headers (4 paragraphs)
var headers = new[] { "Product", "Price", "Qty", "Total" };
for (int i = 0; i < headers.Length; i++)
{
var text = new PdfFormattedText { Text = headers[i], FontSize = 12 };
page.Content.DrawText(text, new PdfPoint(xPositions[i], y));
}
y -= 20;
// Data rows (4 paragraphs per row!)
// Can only add a few rows before hitting 20-paragraph limit!
document.Save("products.pdf");
}
Imports GemBox.Pdf
Imports GemBox.Pdf.Content
ComponentInfo.SetLicense("FREE-LIMITED-KEY")
Using document As New PdfDocument()
Dim page = document.Pages.Add()
Dim y As Double = 700
Dim xPositions As Double() = {50, 200, 300, 400}
' Headers (4 paragraphs)
Dim headers = {"Product", "Price", "Qty", "Total"}
For i As Integer = 0 To headers.Length - 1
Dim text As New PdfFormattedText With {.Text = headers(i), .FontSize = 12}
page.Content.DrawText(text, New PdfPoint(xPositions(i), y))
Next
y -= 20
' Data rows (4 paragraphs per row!)
' Can only add a few rows before hitting 20-paragraph limit!
document.Save("products.pdf")
End Using
Sonra (IronPDF) - Sınır yok, doğru HTML tabloları:
using IronPdf;
IronPdf.License.LicenseKey = "YOUR-LICENSE-KEY";
var html = @"
<html>
<head>
<style>
table { border-collapse: collapse; width: 100%; }
th, td { border: 1px solid #ddd; padding: 8px; text-align: left; }
th { background-color: #4CAF50; color: white; }
tr:nth-child(even) { background-color: #f2f2f2; }
</style>
</head>
<body>
<table>
<thead>
<tr>
<th>Product</th>
<th>Price</th>
<th>Qty</th>
<th>Total</th>
</tr>
</thead>
<tbody>
<tr><td>Widget A</td><td>$19.99</td><td>5</td><td>$99.95</td></tr>
<tr><td>Widget B</td><td>$29.99</td><td>3</td><td>$89.97</td></tr>
</tbody>
</table>
</body>
</html>";
var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderHtmlAsPdf(html);
pdf.SaveAs("products.pdf");
using IronPdf;
IronPdf.License.LicenseKey = "YOUR-LICENSE-KEY";
var html = @"
<html>
<head>
<style>
table { border-collapse: collapse; width: 100%; }
th, td { border: 1px solid #ddd; padding: 8px; text-align: left; }
th { background-color: #4CAF50; color: white; }
tr:nth-child(even) { background-color: #f2f2f2; }
</style>
</head>
<body>
<table>
<thead>
<tr>
<th>Product</th>
<th>Price</th>
<th>Qty</th>
<th>Total</th>
</tr>
</thead>
<tbody>
<tr><td>Widget A</td><td>$19.99</td><td>5</td><td>$99.95</td></tr>
<tr><td>Widget B</td><td>$29.99</td><td>3</td><td>$89.97</td></tr>
</tbody>
</table>
</body>
</html>";
var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderHtmlAsPdf(html);
pdf.SaveAs("products.pdf");
Imports IronPdf
IronPdf.License.LicenseKey = "YOUR-LICENSE-KEY"
Dim html As String = "
<html>
<head>
<style>
table { border-collapse: collapse; width: 100%; }
th, td { border: 1px solid #ddd; padding: 8px; text-align: left; }
th { background-color: #4CAF50; color: white; }
tr:nth-child(even) { background-color: #f2f2f2; }
</style>
</head>
<body>
<table>
<thead>
<tr>
<th>Product</th>
<th>Price</th>
<th>Qty</th>
<th>Total</th>
</tr>
</thead>
<tbody>
<tr><td>Widget A</td><td>$19.99</td><td>5</td><td>$99.95</td></tr>
<tr><td>Widget B</td><td>$29.99</td><td>3</td><td>$89.97</td></tr>
</tbody>
</table>
</body>
</html>"
Dim renderer As New ChromePdfRenderer()
Dim pdf = renderer.RenderHtmlAsPdf(html)
pdf.SaveAs("products.pdf")
Bu,GemBox PDFgeçişinde en önemli gelişmedir. GemBox PDF'nin ücretsiz sürümünde imkansız olan tablolar, IronPDF'de tam CSS stil desteği ile mükemmel çalışır.
Kritik Geçiş Notları
Koordinatları CSS Konumlandırmaya Dönüştürme
Piksel mükemmelliğinde konumlandırma gerekiyorsa (GemBox PDF'nin koordinat sistemine benzer), CSS mutlak konumlandırmayı kullanın:
<div style="position:absolute; left:50px; top:750px; font-size:24px;">
Text positioned at specific coordinates
</div>
<div style="position:absolute; left:50px; top:750px; font-size:24px;">
Text positioned at specific coordinates
</div>
Sayfa İndeksleme
HemGemBox PDFhem de IronPDF, 0 ile indekslenen sayfalar kullanır, bu nedenle bu göçün bu yönü basittir:
// GemBox PDF
var page = document.Pages[0];
// IronPDF
var page = pdf.Pages[0];
// GemBox PDF
var page = document.Pages[0];
// IronPDF
var page = pdf.Pages[0];
' GemBox PDF
Dim page = document.Pages(0)
' IronPDF
Dim page = pdf.Pages(0)
Güvenlik Ayarları
// GemBox PDF
document.SaveOptions.SetPasswordEncryption(userPassword, ownerPassword);
// IronPDF
pdf.SecuritySettings.UserPassword = "userPassword";
pdf.SecuritySettings.OwnerPassword = "ownerPassword";
// GemBox PDF
document.SaveOptions.SetPasswordEncryption(userPassword, ownerPassword);
// IronPDF
pdf.SecuritySettings.UserPassword = "userPassword";
pdf.SecuritySettings.OwnerPassword = "ownerPassword";
' GemBox PDF
document.SaveOptions.SetPasswordEncryption(userPassword, ownerPassword)
' IronPDF
pdf.SecuritySettings.UserPassword = "userPassword"
pdf.SecuritySettings.OwnerPassword = "ownerPassword"
Ariza Giderme
Sorun 1: PdfFormattedText Bulunamadı
Problem: IronPDF'de PdfFormattedText yok.
Çözüm: CSS stili ile HTML kullanın:
// GemBox PDF
var text = new PdfFormattedText { Text = "Hello", FontSize = 24 };
// IronPDF
var html = "<p style='font-size:24px;'>Hello</p>";
var pdf = renderer.RenderHtmlAsPdf(html);
// GemBox PDF
var text = new PdfFormattedText { Text = "Hello", FontSize = 24 };
// IronPDF
var html = "<p style='font-size:24px;'>Hello</p>";
var pdf = renderer.RenderHtmlAsPdf(html);
' GemBox PDF
Dim text As New PdfFormattedText With {.Text = "Hello", .FontSize = 24}
' IronPDF
Dim html As String = "<p style='font-size:24px;'>Hello</p>"
Dim pdf = renderer.RenderHtmlAsPdf(html)
Sorun 2: DrawText Metodu Bulunamadı
Problem: page.Content.DrawText() mevcut değil.
Çözüm: HTML işleme ile içerik oluştur veya damgalar kullanın:
// For new documents - render HTML
var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderHtmlAsPdf("<h1>Content</h1>");
// For existing documents - use stampers
var stamper = new TextStamper() { Text = "Added Text" };
pdf.ApplyStamp(stamper);
// For new documents - render HTML
var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderHtmlAsPdf("<h1>Content</h1>");
// For existing documents - use stampers
var stamper = new TextStamper() { Text = "Added Text" };
pdf.ApplyStamp(stamper);
Imports System
' For new documents - render HTML
Dim renderer As New ChromePdfRenderer()
Dim pdf = renderer.RenderHtmlAsPdf("<h1>Content</h1>")
' For existing documents - use stampers
Dim stamper As New TextStamper() With {.Text = "Added Text"}
pdf.ApplyStamp(stamper)
Sorun 3: Belge Yükleme Farklılıkları
Problem: PdfDocument.Load() bulunamadi.
Cozum: PdfDocument.FromFile() veya FromStream() kullanın:
// GemBox PDF
var doc = PdfDocument.Load("input.pdf");
// IronPDF
var pdf = PdfDocument.FromFile("input.pdf");
// GemBox PDF
var doc = PdfDocument.Load("input.pdf");
// IronPDF
var pdf = PdfDocument.FromFile("input.pdf");
Imports GemBox.Pdf
Imports IronPdf
Dim doc = PdfDocument.Load("input.pdf")
Dim pdf = PdfDocument.FromFile("input.pdf")
Sorun 4: Kaydetme Metodu Farklılıkları
Problem: document.Save() yöntem imzası farklı.
Cozum: SaveAs() kullanın:
// GemBox PDF
document.Save("output.pdf");
// IronPDF
pdf.SaveAs("output.pdf");
// GemBox PDF
document.Save("output.pdf");
// IronPDF
pdf.SaveAs("output.pdf");
' GemBox PDF
document.Save("output.pdf")
' IronPDF
pdf.SaveAs("output.pdf")
Goc Kontrol Listesi
Geçiş Öncesi
- Kod tabanında tümGemBox PDFkullanımını envanter edin
- HTML dönüştürme gerektiren koordinata dayalı yerleşimleri tanımlayın
- Kodunuzu etkileyen mevcut paragraf sınırlamalarını değerlendirin -IronPDFlisans anahtarını edinin
- Sürüm kontrolünde bir geçiş dalı oluşturun
Kod Göçü
-GemBox PDFNuGet paketini kaldırın: dotnet remove package GemBox.Pdf
- IronPdf NuGet paketini yükleyin:
dotnet add package IronPdf - Ad alanı eklerini güncelleyin
ComponentInfo.SetLicense()yerineIronPdf.License.LicenseKeykullanınPdfDocument.Load()dönüştürmeyiPdfDocument.FromFile()olarak yapındocument.Save()dönüştürmeyipdf.SaveAs()olarak yapın- Koordinat tabanlı metni HTML içeriği ile değiştirin
PdfFormattedTextdönüştürme, HTML ile CSS stilini uygulayarak- Birleşme işlemlerini
PdfDocument.Merge()kullanacak şekilde güncelleyin
Test Etme
- Tüm belgelerin doğru şekilde üretildiğini doğrulayın
- Belge görünümünün beklentilerle eşleştiğini doğrulayın
- Tablo oluşturmayı test edin (önceden 20-paragraf kuralı ile sınırlıydı)
- Metin çıkarımının doğru çalıştığını doğrulayın
- Birleştirme ve ayırma operasyonlarını test edin
- Güvenlik/şifreleme işlevselliğini doğrulayın
Geçişten Sonra
-GemBox PDFlisans anahtarlarını kaldırın
- Belgeleri güncelleyin
- Ekibe PDF'ler için HTML/CSS yaklaşımı konusunda eğitim verin
- Paragraf sınırı olmadan sınırsız içeriğin tadını çıkarın!

