Altbilgi içeriğine atla
GEçIş KıLAVUZLARı

GemBox PDF'den IronPDF'e C# ile Nasıl Geçilir

GemBox.Pdf'den IronPDF'ye taşıma, .NET PDF iş akışınızı koordinat-tabancı programatik belge inşaatından modern HTML/CSS temelli render'a dönüştürür. Bu kılavuz, 2 sayfa ücretsiz mod sınırını kaldıran ve profesyonel .NET geliştiricileri için belge oluşturmayı basitleştiren kapsamlı, adım adım bir taşıma yolu sunar.

Neden GemBox.Pdf'den IronPDF'ye Geçmeli

GemBox.Pdf Zorlukları

GemBox.Pdf yetenekli bir .NET PDF bileşenidir, ancak gerçek dünya gelişimi için değerlendirilecek sınırlamaları vardır:

  1. 2-Sayfa Ücretsiz-Mod Limiti: Ücretsiz sürüm, 2 sayfanın ötesinde bir PDF yüklerken veya kaydederken FreeLimitReachedException hatası verir, bu yüzden bir sayfalık makbuz veya iki sayfalık fatura dışında kalan her şey ücretli lisans gerektirir. (Source: gemboxsoftware.com/pdf/free-version.)

  2. HTML'den PDF'e Dönüşüm Yok: GemBox.Pdf HTML'yi işleyemez — PdfDocument.Load yalnızca mevcut PDF dosyalarını açar. HTML'yi PDF'ye çevirmek için ayrı bir GemBox.Document ürünü satın almanız gerekir (farklı SKU, farklı lisans).

  3. Koordinat-Tabanlı Düzen: GemBox.Pdf düşük-seviyeli PDF içerik akışı API'sidir. Metin yerleştirmek için PDF kullanıcı alanı birimlerinde X/Y hesaplaması yapın ve page.Content.DrawText(formattedText, new PdfPoint(x, y)) çağırın. Akış düzeni yoktur.

  4. Office-to-PDF Diğer SKU'ları Gerektirir: Word→PDF, GemBox.Document'i gerektirir, Excel→PDF GemBox.Spreadsheet'i gerektirir, her biri ayrı ayrı lisanslanır; GemBox.Bundle hepsiyle ilgilidir ancak daha fazla maliyetlidir.

  5. Sadece Programatik: Her tasarım değişikliği kod değişikliği gerektirir. Aralık mı ayarlamak? Koordinatları yeniden hesaplayın. Bir yazı tipi boyutunu değiştirmek mi? Altındaki Y pozisyonlarını ayarlayın.

  6. Ticari-Lisans Fiyatlandırması: Tek geliştirici lisansı $890 (yenileme $534), küçük ekip (10 geliştirici) $4,450, büyük ekip (50 geliştirici) $13,350. (Kaynak: gemboxsoftware.com/pdf/pricing.)

  7. Tasarım için Öğrenme Eğrisi: Geliştiriciler, belge akışı yerine koordinatları düşünmelidir, bu da "bir paragraf eklemek" gibi basit görevleri şaşırtıcı derecede karmaşık hale getirir.

GemBox.Pdf ve IronPDF Karşılaştırması

Aspekt GemBox.Pdf IronPDF
Ücretsiz Versiyon Sınırları 2 sayfa azami (FreeLimitReachedException) Sadece filigran, sayfa sınırı yok
HTML'den PDF'ye Desteklenmiyor (GemBox.Document gerek) Tam Chrome motoru
Word/Excel → PDF Ayrı SKU'lar (GemBox.Document / GemBox.Spreadsheet) HTML hattı vasıtasıyla işleme
Düzen Yaklaşımı Koordinat tabanlı, manuel HTML/CSS akış düzeni
Modern CSS Uygulanamaz Flexbox, Grid, CSS3 animasyonları
JavaScript Desteği Uygulanamaz Tam JavaScript yürütme
Tasarım Değişiklikleri Koordinatları yeniden hesaplayın HTML/CSS düzenleyin
Öğrenme Eğrisi PDF koordinat sistemi HTML/CSS (web tanıdık)

IronPDF, modern .NET üzerinde PDF oluşturma için tanıdık web teknolojilerini kullanır.


Göç Karmaşıklığı 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 Ayırma Düşük
Metin Çıkarma Çok Düşük
Metin Ekle Orta
Tablolar Düşük
Görseller Düşük
Filigranlar Düşük
Şifre Koruması Orta
Form Alanları Orta

Paradigma Değişimi

Bu GemBox.Pdf taşımasındaki en büyük değişiklik, koordinat-tabanlı düzenden HTML/CSS düzenine:

GemBox.Pdf:  "Metni konumda (100, 700) çiz"
IronPDF: "Bu HTML'yi CSS stillendirme ile işleyin"

Bu paradigma değişimi, web teknolojilerine aşina geliştiriciler için genellikle daha kolaydır, ancak PDF'le ilgili düşünme biçimlerinin değişmesini gerektirir.


Başlamadan Önce

Ön Koşullar

  1. .NET Sürümü: IronPDF, .NET Framework 4.6.2+ ve .NET Core 2.0+ / .NET 5+ destekler
  2. Lisans Anahtarı:IronPDF lisans anahtarınızı ironpdf.com'dan edinin
  3. Yedekleme: Geçiş çalışmaları için bir dal oluşturun
  4. HTML/CSS Bilgisi: Temel aşinalık yardımcıdır ancak zorunlu değildir

Tüm GemBox.Pdf Kullanımını Belirleyin

# Find all GemBox.Pdf references
grep -r "GemBox\.Pdf\|PdfDocument\|PdfPage\|PdfFormattedText\|ComponentInfo\.SetLicense" --include="*.cs" .

# Find package references
grep -r "GemBox\.Pdf" --include="*.csproj" .
# Find all GemBox.Pdf references
grep -r "GemBox\.Pdf\|PdfDocument\|PdfPage\|PdfFormattedText\|ComponentInfo\.SetLicense" --include="*.cs" .

# Find package references
grep -r "GemBox\.Pdf" --include="*.csproj" .
SHELL

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
SHELL

Hızlı Başlangıç Göçü

Adım 1: Lisans Yapılandırmasını Güncelleyin

Before (GemBox.Pdf):

// Must call before any GemBox.Pdf operations
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");
' Must call before any GemBox.Pdf operations
ComponentInfo.SetLicense("FREE-LIMITED-KEY")
' Or for professional:
ComponentInfo.SetLicense("YOUR-PROFESSIONAL-LICENSE")
$vbLabelText   $csharpLabel

Sonrası (IronPDF):

// Set once at application startup
IronPdf.License.LicenseKey = "YOUR-LICENSE-KEY";

// Or in appsettings.json:
// { "IronPdf.License.LicenseKey": "YOUR-LICENSE-KEY" }
// Set once at application startup
IronPdf.License.LicenseKey = "YOUR-LICENSE-KEY";

// Or in appsettings.json:
// { "IronPdf.License.LicenseKey": "YOUR-LICENSE-KEY" }
Imports IronPdf

' Set once at application startup
IronPdf.License.LicenseKey = "YOUR-LICENSE-KEY"

' Or in appsettings.json:
' { "IronPdf.License.LicenseKey": "YOUR-LICENSE-KEY" }
$vbLabelText   $csharpLabel

Adım 2: Ad Alanı İthalatları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
$vbLabelText   $csharpLabel

Adım 3: Temel Dönüştürme Kalıbı

Before (GemBox.Pdf):

using GemBox.Pdf;
using GemBox.Pdf.Content;

ComponentInfo.SetLicense("FREE-LIMITED-KEY");

using (var document = new PdfDocument())
{
    var page = document.Pages.Add();
    // PdfFormattedText has no Text property; use Append/AppendLine.
    var formattedText = new PdfFormattedText();
    formattedText.FontSize = 24;
    formattedText.Append("Hello World");

    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();
    // PdfFormattedText has no Text property; use Append/AppendLine.
    var formattedText = new PdfFormattedText();
    formattedText.FontSize = 24;
    formattedText.Append("Hello World");

    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()
    ' PdfFormattedText has no Text property; use Append/AppendLine.
    Dim formattedText As New PdfFormattedText()
    formattedText.FontSize = 24
    formattedText.Append("Hello World")

    page.Content.DrawText(formattedText, New PdfPoint(100, 700))
    document.Save("output.pdf")
End Using
$vbLabelText   $csharpLabel

Sonrası (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")
$vbLabelText   $csharpLabel

Ana Farklılıklar:

  • Koordinat hesaplaması gerekmiyor
  • Programatik düzen yerine HTML/CSS
  • 2-sayfa ücretsiz mod tavanı yok
  • Daha basit, daha okunabilir kod

Tam API Referansı

Namespace Haritalama

GemBox.Pdf IronPDF
GemBox.Pdf IronPdf
GemBox.Pdf.Content IronPdf (içerik HTML'dir)
GemBox.Pdf.Security IronPdf (SecuritySettings)
GemBox.Pdf.Forms IronPdf.Forms

Temel Sınıf Eşlemeleri

GemBox.Pdf IronPDF Açıklama
PdfDocument PdfDocument Ana PDF döküman 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 Yok (CSS konumlandırması kullanın) Koordinat konumlandırması
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.BinaryData ( dönen byte[])

Sayfa İşlemleri

GemBox.Pdf IronPDF
document.Pages.Add() HTML renderleme yoluyla 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 dizgisi
formattedText.Append(text) HTML'ye dahil et
formattedText.AppendLine(text) HTML'ye dahil et
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 Göç Örnekleri

Örnek 1: HTML'den PDF'ye Dönüştürme

Önce (GemBox.Pdf) — GemBox.Pdf tarafından desteklenmez; ayrı GemBox.Document SKU'su gerektirir:

// NuGet: Install-Package GemBox.Document
// NOTE: GemBox.Pdf does NOT support HTML-to-PDF. PdfDocument.Load only opens
// existing PDF files. To convert HTML to PDF you must use the separate
// GemBox.Document product (different SKU, different license).
using GemBox.Document;

class Program
{
    static void Main()
    {
        ComponentInfo.SetLicense("FREE-LIMITED-KEY");

        // GemBox.Document loads HTML and saves as PDF.
        var document = DocumentModel.Load("input.html");
        document.Save("output.pdf");
    }
}
// NuGet: Install-Package GemBox.Document
// NOTE: GemBox.Pdf does NOT support HTML-to-PDF. PdfDocument.Load only opens
// existing PDF files. To convert HTML to PDF you must use the separate
// GemBox.Document product (different SKU, different license).
using GemBox.Document;

class Program
{
    static void Main()
    {
        ComponentInfo.SetLicense("FREE-LIMITED-KEY");

        // GemBox.Document loads HTML and saves as PDF.
        var document = DocumentModel.Load("input.html");
        document.Save("output.pdf");
    }
}
Imports GemBox.Document

Module Program

    Sub Main()
        ComponentInfo.SetLicense("FREE-LIMITED-KEY")

        ' GemBox.Document loads HTML and saves as PDF.
        Dim document = DocumentModel.Load("input.html")
        document.Save("output.pdf")
    End Sub

End Module
$vbLabelText   $csharpLabel

Sonrası (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
$vbLabelText   $csharpLabel

IronPDF'nin ChromePdfRenderer HTML/CSS/JavaScript işleme için modern bir Chromium motoru kullanır, böylece tek bir NuGet paketi doğrudan HTML'den PDF'e dönüşümü kapsar — ayrı bir SKU gerekmez. Daha fazla renderleme seçenekleri için HTML'den PDF'ye dökümantasyon'a bakın.

Örnek 2: PDF Dosyalarını Birleştirin

Before (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
$vbLabelText   $csharpLabel

Sonrası (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
$vbLabelText   $csharpLabel

IronPDF'nin statik Merge metodu işlemi basitleştirir — boş bir belge oluşturup sayfaları tek tek kopyalamanıza gerek yoktur. Daha fazla bilgi edinin PDF birleştirme ve bölme.

Örnek 3: PDF'ye Metin Ekle

Before (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();
            // PdfFormattedText has no Text property; use Append/AppendLine.
            var formattedText = new PdfFormattedText();
            formattedText.FontSize = 24;
            formattedText.Append("Hello World");

            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();
            // PdfFormattedText has no Text property; use Append/AppendLine.
            var formattedText = new PdfFormattedText();
            formattedText.FontSize = 24;
            formattedText.Append("Hello World");

            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()
            ' PdfFormattedText has no Text property; use Append/AppendLine.
            Dim formattedText As New PdfFormattedText()
            formattedText.FontSize = 24
            formattedText.Append("Hello World")

            page.Content.DrawText(formattedText, New PdfPoint(100, 700))
            document.Save("output.pdf")
        End Using
    End Sub

End Module
$vbLabelText   $csharpLabel

Sonrası (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
$vbLabelText   $csharpLabel

Mevcut PDF'lere metin eklemek için,IronPDF tam konumlandırma kontrolü sunan TextStamper sınıfını sağlar. Yeni belgeler için, sadece metni HTML şablonunuza dahil edin. Ek seçenekler için damgalama dokümantasyonuna bakın.

Örnek 4: Tablo Oluşturma (En Büyük İyileştirme!)

Önce (GemBox.Pdf) — koordinat-tabanlı düzen, ücretsiz modda 2 sayfaya kadar sınırlıdı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
    var headers = new[] { "Product", "Price", "Qty", "Total" };
    for (int i = 0; i < headers.Length; i++)
    {
        var text = new PdfFormattedText();
        text.FontSize = 12;
        text.Append(headers[i]);
        page.Content.DrawText(text, new PdfPoint(xPositions[i], y));
    }
    y -= 20;

    // Data rows — each row requires manual Y advancement,
    // and free mode caps the saved file at 2 pages total.

    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
    var headers = new[] { "Product", "Price", "Qty", "Total" };
    for (int i = 0; i < headers.Length; i++)
    {
        var text = new PdfFormattedText();
        text.FontSize = 12;
        text.Append(headers[i]);
        page.Content.DrawText(text, new PdfPoint(xPositions[i], y));
    }
    y -= 20;

    // Data rows — each row requires manual Y advancement,
    // and free mode caps the saved file at 2 pages total.

    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
    Dim headers = New String() {"Product", "Price", "Qty", "Total"}
    For i As Integer = 0 To headers.Length - 1
        Dim text As New PdfFormattedText()
        text.FontSize = 12
        text.Append(headers(i))
        page.Content.DrawText(text, New PdfPoint(xPositions(i), y))
    Next
    y -= 20

    ' Data rows — each row requires manual Y advancement,
    ' and free mode caps the saved file at 2 pages total.

    document.Save("products.pdf")
End Using
$vbLabelText   $csharpLabel

Sonra (IronPDF) — sayfa sınırı yok, düzgün 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")
$vbLabelText   $csharpLabel

Bu, GemBox.Pdf taşımasındaki en önemli gelişmedir. Ücretsiz mod GemBox.Pdf belgesini 2 sayfa sınırının ötesine itecek tablolar, IronPDF'de bu sınır olmadan, tam CSS stil desteği ile işler.


Kritik Taşıma Notları

Koordinattan CSS Konumlandırmasına Geçiş

Pixel-mükemmel konumlandırmaya ihtiyacınız varsa (GemBox.Pdf'in koordinat sistemi gibi), 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>
HTML

Sayfa İndeksleme

Hem GemBox.Pdf hem de IronPDF, 0-indeksli sayfalar kullanır, bu taşıma işlemi açısından bu yönü basit kılar:

// 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)
$vbLabelText   $csharpLabel

Güvenlik Ayarları

// GemBox.Pdf
var encryption = document.SaveOptions.SetPasswordEncryption();
encryption.DocumentOpenPassword = "userPassword";
encryption.PermissionsPassword = "ownerPassword";

// IronPDF
pdf.SecuritySettings.UserPassword = "userPassword";
pdf.SecuritySettings.OwnerPassword = "ownerPassword";
// GemBox.Pdf
var encryption = document.SaveOptions.SetPasswordEncryption();
encryption.DocumentOpenPassword = "userPassword";
encryption.PermissionsPassword = "ownerPassword";

// IronPDF
pdf.SecuritySettings.UserPassword = "userPassword";
pdf.SecuritySettings.OwnerPassword = "ownerPassword";
' GemBox.Pdf
Dim encryption = document.SaveOptions.SetPasswordEncryption()
encryption.DocumentOpenPassword = "userPassword"
encryption.PermissionsPassword = "ownerPassword"

' IronPDF
pdf.SecuritySettings.UserPassword = "userPassword"
pdf.SecuritySettings.OwnerPassword = "ownerPassword"
$vbLabelText   $csharpLabel

Hata Ayıklama

Sorun 1: PdfFormattedText Bulunamadı

Sorun: PdfFormattedTextIronPDF içinde mevcut değil.

Çözüm: HTML ile CSS stilini kullanın:

// GemBox.Pdf
var text = new PdfFormattedText();
text.FontSize = 24;
text.Append("Hello");

// IronPDF
var html = "<p style='font-size:24px;'>Hello</p>";
var pdf = renderer.RenderHtmlAsPdf(html);
// GemBox.Pdf
var text = new PdfFormattedText();
text.FontSize = 24;
text.Append("Hello");

// IronPDF
var html = "<p style='font-size:24px;'>Hello</p>";
var pdf = renderer.RenderHtmlAsPdf(html);
Imports GemBox.Pdf
Imports IronPDF

Dim text As New PdfFormattedText()
text.FontSize = 24
text.Append("Hello")

Dim html As String = "<p style='font-size:24px;'>Hello</p>"
Dim pdf = renderer.RenderHtmlAsPdf(html)
$vbLabelText   $csharpLabel

Sorun 2: DrawText Yöntemi Bulunamadı

Sorun: page.Content.DrawText() kullanılabilir değil.

Çözüm: İçeriği HTML renderleme yoluyla oluşturun veya damga 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)
$vbLabelText   $csharpLabel

Sorun 3: Belge Yükleme Farklılıkları

Sorun: PdfDocument.Load() bulunamadı.

Çözüm: 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")
$vbLabelText   $csharpLabel

Sorun 4: Kaydetme Yöntemi Farklılıkları

Sorun: document.Save() metod imzası farklı.

Çözüm: 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");
$vbLabelText   $csharpLabel

Geçiş Kontrol Listesi

Öncesi-Geçiş

  • Kod tabanında GemBox.Pdf kullanımının envanterini çıkarın
  • HTML dönüşümü gerektiren koordinat tabanlı düzenleri belirleyin
  • 2 sayfa ücretsiz mod sınırının kodunuzu nasıl etkilediğini değerlendirin -IronPDF lisans anahtarını edinin
  • Sürüm kontrolünde geçiş dalı oluşturun

Kod Geçişi

  • GemBox.Pdf NuGet paketini kaldırın: dotnet remove package GemBox.Pdf -IronPDF NuGet paketini yükleyin: dotnet add package IronPdf
  • Ad alanı ithalatlarını güncelleyin
  • ComponentInfo.SetLicense() yerine IronPdf.License.LicenseKey kullanın
  • PdfDocument.Load() öğesini PdfDocument.FromFile() olarak dönüştürün
  • document.Save() öğesini pdf.SaveAs() olarak dönüştürün
  • Koordinat tabanlı metni HTML içeriğiyle değiştirin
  • PdfFormattedText'i CSS stil ile HTML'e dönüştürün
  • Birleştirme işlemlerini PdfDocument.Merge() kullanacak şekilde güncelleyin

Test Etme

  • Tüm belgelerin doğru şekilde oluşturulduğunu doğrulayın
  • Belge görünümünün beklentilere uygun olduğunu doğrulayın
  • Çok sayfalı çıktıyı test edin (daha önce ücretsiz modda 2 sayfa ile sınırlıydı)
  • Metin çıkarmanın doğru çalıştığını doğrulayın
  • Birleştirme ve bölme işlemlerini test edin
  • Güvenlik/şifreleme işlevselliğini doğrulayın

Geçiş Sonrası

  • GemBox.Pdf lisans anahtarlarını kaldırın
  • Belgeleri güncelleyin
  • Takımı PDF'ler için HTML/CSS yaklaşımı hakkında eğitin
  • Ücretsiz mod sınırı olmadan sınırsız sayfa sayılarından yararlanın!

Lütfen dikkate alınGemBox.Pdf, ilgili sahibinin tescilli markasıdır. Bu site, GemBox Software Ltd. ile bağlantılı, onaylı veya sponsorlu değildir. Tüm ürün adları, logolar ve markalar ilgili sahiplerinin mülküdür. Karşılaştırmalar, yalnızca bilgilendirme amaçlıdır ve yazı sırasında halka açık bilgilerle alakalı olarak yansıtılmaktadır.

Curtis Chau
Teknik Yazar

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ı...

Daha Fazla Oku

Iron Destek Ekibi

Haftada 5 gün, 24 saat çevrimiçiyiz.
Sohbet
E-posta
Beni Ara