Przejdź do treści stopki
PRZEWODNIKI MIGRACJI

Jak przeprowadzić migrację z ComPDFKit do IronPDF w języku C#

ChociażComPDFKitoferuje solidne funkcje manipulacji plikami PDF, kilka czynników skłania zespoły programistów do rozważenia bardziej uznanych alternatyw.

Dojrzałość rynku i porównanie ekosystemów

ComPDFKit boryka się z wyzwaniami typowymi dla nowych graczy na rynku: brakami w dokumentacji, mniejszą społecznością i ograniczonym zasięgiem na Stack Overflow. Dziesięć lat udoskonaleńIronPDFzapewnia stabilność i zasoby wymagane w projektach Enterprise.

Aspekt ComPDFKit IronPDF
HTML do PDF Wymaga ręcznego parsowania HTML Natwyna renderowanie Chromium
Dojrzałość rynku Nowszy uczestnik Ponad 10 lat, wypróbowany w boju
Wielkość społeczności Mniej liczna, ograniczona społeczność Stack Overflow Duża, aktywna społeczność
Dokumentacja Niektóre luki Obszerne samouczki i przewodniki
Pliki do pobrania Rosnąca Ponad 10 milionów pobrań z NuGet
Styl API Wpływ C++, rozbudowane Nowoczesne .NET płynne API
Zarządzanie pamięcią Ręczne wywołania Release() Automatyczne zarządzanie GC

Równowaga funkcji

Obie biblioteki obsługują kompleksową funkcjonalność PDF:

Funkcja ComPDFKit IronPDF
HTML do PDF Podstawowy/Ręczny ✅ Natywne Chromium
URL do pliku PDF Ręczna implementacja ✅ Wbudowane
Utwórz plik PDF od podstaw
Edycja PDF
Wyodrębnianie tekstu
Scal/Podziel
Podpisy cyfrowe
Wypełnianie formularzy
Znaki wodne
Wieloplatformowe Windows, Linux, macOS Windows, Linux, macOS

Kluczowe korzyści z migracji

  1. Doskonałe renderowanie HTML: silnik Chromium wIronPDFnatywnie obsługuje nowoczesne CSS3, JavaScript i responsywne układy stron
  2. Dojrzały ekosystem: ponad 10 lat udoskonaleń, obszerna dokumentacja i sprawdzona stabilność
  3. Prostsze API: mniej kodu szablonowego, brak ręcznego zarządzania pamięcią dzięki wywołaniom Release()
  4. Lepsza integracja z platformą .NET: natywne async/await, obsługa LINQ, płynne interfejsy
  5. Bogate zasoby: tysiące odpowiedzi na Stack Overflow i przykładów ze społeczności

Przygotowania przed migracją

Wymagania wstępne

Upewnij się, że Twoje środowisko spełnia następujące wymagania:

  • .NET Framework 4.6.2+ lub .NET Core 3.1 / .NET 5-9
  • Visual Studio 2019+ lub VS Code z rozszerzeniem C#
  • Dostęp do menedżera pakietów NuGet
  • Klucz licencyjnyIronPDF(bezpłatna wersja próbna dostępna na stronie ironpdf.com)

Audyt wykorzystania ComPDFKit

Uruchom te polecenia w katalogu rozwiązania, aby zidentyfikować wszystkie odwołania do ComPDFKit:

# Find allComPDFKitusages in your codebase
grep -r "using ComPDFKit" --include="*.cs" .
grep -r "CPDFDocument\|CPDFPage\|CPDFAnnotation" --include="*.cs" .

# Find NuGet package references
grep -r "ComPDFKit" --include="*.csproj" .
# Find allComPDFKitusages in your codebase
grep -r "using ComPDFKit" --include="*.cs" .
grep -r "CPDFDocument\|CPDFPage\|CPDFAnnotation" --include="*.cs" .

# Find NuGet package references
grep -r "ComPDFKit" --include="*.csproj" .
SHELL

Zmiany wymagające dostosowania

Zmiana ComPDFKit IronPDF Wpływ
Ładowanie dokumentów CPDFDocument.InitWithFilePath() PdfDocument.FromFile() Zmiana nazwy metody
Zapisywanie document.WriteToFilePath() pdf.SaveAs() Zmiana nazwy metody
Czyszczenie pamięci document.Release() wymagane Automatyczne (GC) Usuń ręczne czyszczenie
Dostęp do strony document.PageAtIndex(i) pdf.Pages[i] Dostęp w stylu tablicowym
Indeksowanie stron bazujący na 0 bazujący na 0 Nie ma potrzeby wprowadzania zmian
Renderowanie HTML Ręczna implementacja RenderHtmlAsPdf() Znaczące uproszczenie
Wyodrębnianie tekstu textPage.GetText() pdf.ExtractAllText() Uproszczone API

Proces migracji krok po kroku

Krok 1: Zaktualizuj pakiety NuGet

Usuń pakietyComPDFKiti zainstaluj IronPDF:

# RemoveComPDFKitpackages
dotnet remove package ComPDFKit.NetCore
dotnet remove package ComPDFKit.NetFramework

# Install IronPDF
dotnet add package IronPdf
# RemoveComPDFKitpackages
dotnet remove package ComPDFKit.NetCore
dotnet remove package ComPDFKit.NetFramework

# Install IronPDF
dotnet add package IronPdf
SHELL

Krok 2: Aktualizacja odniesień do przestrzeni nazw

Zastąp przestrzenie nazwComPDFKitprzez IronPDF:

// Remove these
using ComPDFKit.PDFDocument;
using ComPDFKit.PDFPage;
using ComPDFKit.PDFAnnotation;
using ComPDFKit.Import;

// Add this
using IronPdf;
// Remove these
using ComPDFKit.PDFDocument;
using ComPDFKit.PDFPage;
using ComPDFKit.PDFAnnotation;
using ComPDFKit.Import;

// Add this
using IronPdf;
Imports IronPdf
$vbLabelText   $csharpLabel

Krok 3: Skonfiguruj licencję

// Add at application startup (Program.cs or Global.asax)
IronPdf.License.LicenseKey = "YOUR-LICENSE-KEY";
// Add at application startup (Program.cs or Global.asax)
IronPdf.License.LicenseKey = "YOUR-LICENSE-KEY";
' Add at application startup (Program.vb or Global.asax)
IronPdf.License.LicenseKey = "YOUR-LICENSE-KEY"
$vbLabelText   $csharpLabel

Kompletna dokumentacja API

Operacje na dokumentach

Zadanie ComPDFKit IronPDF
Utwórz pusty dokument CPDFDocument.CreateDocument() new PdfDocument()
Wczytaj z pliku CPDFDocument.InitWithFilePath(path) PdfDocument.FromFile(path)
Wczytaj ze strumienia CPDFDocument.InitWithStream(stream) PdfDocument.FromStream(stream)
Zapisz do pliku document.WriteToFilePath(path) pdf.SaveAs(path)
Sprawdź liczbę stron document.PageCount pdf.PageCount
Wydanie/Usunięcie document.Release() Nie jest wymagane

Konwersja HTML do PDF

Zadanie ComPDFKit IronPDF
Ciąg znaków HTML do pliku PDF Wymagana ręczna implementacja renderer.RenderHtmlAsPdf(html)
Plik HTML do PDF Wymagana ręczna implementacja renderer.RenderHtmlFileAsPdf(path)
URL do pliku PDF Wymagana ręczna implementacja renderer.RenderUrlAsPdf(url)
Ustaw rozmiar strony Za pomocą parametrów tworzenia strony renderer.RenderingOptions.PaperSize
Ustaw marginesy Poprzez konfigurację edytora renderer.RenderingOptions.MarginTop itp.

Operacje scalania i dzielenia

Zadanie ComPDFKit IronPDF
Połącz dokumenty doc1.ImportPagesAtIndex(doc2, range, index) PdfDocument.Merge(pdf1, pdf2)
Podziel dokument Wyodrębnij strony do nowego dokumentu pdf.CopyPages(start, end)

Przykłady migracji kodu

Konwersja HTML do PDF

Najważniejszą różnicą międzyComPDFKitaIronPDFjest renderowanie HTML.ComPDFKitwymaga ręcznego umieszczania tekstu, podczas gdyIronPDFrenderuje HTML natywnie za pomocą silnika Chromium.

Wdrożenie ComPDFKit:

// NuGet: Install-Package ComPDFKit.NetCore
using ComPDFKit.PDFDocument;
using System;

class Program
{
    static void Main()
    {
        var document = CPDFDocument.CreateDocument();
        var page = document.InsertPage(0, 595, 842, "");

        //ComPDFKitrequires manual HTML rendering
        // Native HTML do PDF not directly supported
        var editor = page.GetEditor();
        editor.BeginEdit(CPDFEditType.EditText);
        editor.CreateTextWidget(new System.Drawing.RectangleF(50, 50, 500, 700), "HTML content here");
        editor.EndEdit();

        document.WriteToFilePath("output.pdf");
        document.Release();
    }
}
// NuGet: Install-Package ComPDFKit.NetCore
using ComPDFKit.PDFDocument;
using System;

class Program
{
    static void Main()
    {
        var document = CPDFDocument.CreateDocument();
        var page = document.InsertPage(0, 595, 842, "");

        //ComPDFKitrequires manual HTML rendering
        // Native HTML do PDF not directly supported
        var editor = page.GetEditor();
        editor.BeginEdit(CPDFEditType.EditText);
        editor.CreateTextWidget(new System.Drawing.RectangleF(50, 50, 500, 700), "HTML content here");
        editor.EndEdit();

        document.WriteToFilePath("output.pdf");
        document.Release();
    }
}
Imports ComPDFKit.PDFDocument
Imports System
Imports System.Drawing

Module Program
    Sub Main()
        Dim document = CPDFDocument.CreateDocument()
        Dim page = document.InsertPage(0, 595, 842, "")

        ' ComPDFKit requires manual HTML rendering
        ' Native HTML to PDF not directly supported
        Dim editor = page.GetEditor()
        editor.BeginEdit(CPDFEditType.EditText)
        editor.CreateTextWidget(New RectangleF(50, 50, 500, 700), "HTML content here")
        editor.EndEdit()

        document.WriteToFilePath("output.pdf")
        document.Release()
    End Sub
End Module
$vbLabelText   $csharpLabel

Wdrożenie IronPDF:

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

class Program
{
    static void Main()
    {
        var renderer = new ChromePdfRenderer();
        var pdf = renderer.RenderHtmlAsPdf("<h1>Hello World</h1><p>This is HTML content.</p>");
        pdf.SaveAs("output.pdf");
    }
}
// NuGet: Install-Package IronPdf
using IronPdf;
using System;

class Program
{
    static void Main()
    {
        var renderer = new ChromePdfRenderer();
        var pdf = renderer.RenderHtmlAsPdf("<h1>Hello World</h1><p>This is HTML content.</p>");
        pdf.SaveAs("output.pdf");
    }
}
Imports IronPdf
Imports System

Class Program
    Shared Sub Main()
        Dim renderer = New ChromePdfRenderer()
        Dim pdf = renderer.RenderHtmlAsPdf("<h1>Hello World</h1><p>This is HTML content.</p>")
        pdf.SaveAs("output.pdf")
    End Sub
End Class
$vbLabelText   $csharpLabel

ChromePdfRendererIronPDFeliminuje konieczność ręcznego pozycjonowania tekstu i zarządzania edytorem. Aby uzyskać więcej opcji konwersji HTML, zapoznaj się z dokumentacją dotyczącą konwersji HTML do PDF.

Łączenie wielu plików PDF

Wdrożenie ComPDFKit:

// NuGet: Install-Package ComPDFKit.NetCore
using ComPDFKit.PDFDocument;
using ComPDFKit.Import;
using System;

class Program
{
    static void Main()
    {
        var document1 = CPDFDocument.InitWithFilePath("file1.pdf");
        var document2 = CPDFDocument.InitWithFilePath("file2.pdf");

        // Import pages from document2 into document1
        document1.ImportPagesAtIndex(document2, "0-" + (document2.PageCount - 1), document1.PageCount);

        document1.WriteToFilePath("merged.pdf");
        document1.Release();
        document2.Release();
    }
}
// NuGet: Install-Package ComPDFKit.NetCore
using ComPDFKit.PDFDocument;
using ComPDFKit.Import;
using System;

class Program
{
    static void Main()
    {
        var document1 = CPDFDocument.InitWithFilePath("file1.pdf");
        var document2 = CPDFDocument.InitWithFilePath("file2.pdf");

        // Import pages from document2 into document1
        document1.ImportPagesAtIndex(document2, "0-" + (document2.PageCount - 1), document1.PageCount);

        document1.WriteToFilePath("merged.pdf");
        document1.Release();
        document2.Release();
    }
}
Imports ComPDFKit.PDFDocument
Imports ComPDFKit.Import
Imports System

Module Program
    Sub Main()
        Dim document1 = CPDFDocument.InitWithFilePath("file1.pdf")
        Dim document2 = CPDFDocument.InitWithFilePath("file2.pdf")

        ' Import pages from document2 into document1
        document1.ImportPagesAtIndex(document2, "0-" & (document2.PageCount - 1), document1.PageCount)

        document1.WriteToFilePath("merged.pdf")
        document1.Release()
        document2.Release()
    End Sub
End Module
$vbLabelText   $csharpLabel

Wdrożenie IronPDF:

// NuGet: Install-Package IronPdf
using IronPdf;
using System;
using System.Collections.Generic;

class Program
{
    static void Main()
    {
        var pdf1 = PdfDocument.FromFile("file1.pdf");
        var pdf2 = PdfDocument.FromFile("file2.pdf");

        var merged = PdfDocument.Merge(new List<PdfDocument> { pdf1, pdf2 });
        merged.SaveAs("merged.pdf");
    }
}
// NuGet: Install-Package IronPdf
using IronPdf;
using System;
using System.Collections.Generic;

class Program
{
    static void Main()
    {
        var pdf1 = PdfDocument.FromFile("file1.pdf");
        var pdf2 = PdfDocument.FromFile("file2.pdf");

        var merged = PdfDocument.Merge(new List<PdfDocument> { pdf1, pdf2 });
        merged.SaveAs("merged.pdf");
    }
}
Imports IronPdf
Imports System
Imports System.Collections.Generic

Module Program
    Sub Main()
        Dim pdf1 = PdfDocument.FromFile("file1.pdf")
        Dim pdf2 = PdfDocument.FromFile("file2.pdf")

        Dim merged = PdfDocument.Merge(New List(Of PdfDocument) From {pdf1, pdf2})
        merged.SaveAs("merged.pdf")
    End Sub
End Module
$vbLabelText   $csharpLabel

Statyczna metoda MergeIronPDFeliminuje rozbudowany wzorzec ImportPagesAtIndex z ciągami znaków określającymi zakres stron. Aby uzyskać więcej opcji, zapoznaj się z dokumentacją dotyczącą scalania plików PDF.

Dodawanie znaków wodnych

Zastosowanie znaków wodnych ilustruje zmianę paradygmatu z podejścia opartego na edytorze wComPDFKitna stylizację opartą na HTML w IronPDF.

Wdrożenie ComPDFKit:

// NuGet: Install-Package ComPDFKit.NetCore
using ComPDFKit.PDFDocument;
using ComPDFKit.PDFPage;
using System;
using System.Drawing;

class Program
{
    static void Main()
    {
        var document = CPDFDocument.InitWithFilePath("input.pdf");

        for (int i = 0; i < document.PageCount; i++)
        {
            var page = document.PageAtIndex(i);
            var editor = page.GetEditor();
            editor.BeginEdit(CPDFEditType.EditText);

            var textArea = editor.CreateTextArea();
            textArea.SetText("CONFIDENTIAL");
            textArea.SetFontSize(48);
            textArea.SetTransparency(128);

            editor.EndEdit();
            page.Release();
        }

        document.WriteToFilePath("watermarked.pdf");
        document.Release();
    }
}
// NuGet: Install-Package ComPDFKit.NetCore
using ComPDFKit.PDFDocument;
using ComPDFKit.PDFPage;
using System;
using System.Drawing;

class Program
{
    static void Main()
    {
        var document = CPDFDocument.InitWithFilePath("input.pdf");

        for (int i = 0; i < document.PageCount; i++)
        {
            var page = document.PageAtIndex(i);
            var editor = page.GetEditor();
            editor.BeginEdit(CPDFEditType.EditText);

            var textArea = editor.CreateTextArea();
            textArea.SetText("CONFIDENTIAL");
            textArea.SetFontSize(48);
            textArea.SetTransparency(128);

            editor.EndEdit();
            page.Release();
        }

        document.WriteToFilePath("watermarked.pdf");
        document.Release();
    }
}
Imports ComPDFKit.PDFDocument
Imports ComPDFKit.PDFPage
Imports System
Imports System.Drawing

Module Program
    Sub Main()
        Dim document = CPDFDocument.InitWithFilePath("input.pdf")

        For i As Integer = 0 To document.PageCount - 1
            Dim page = document.PageAtIndex(i)
            Dim editor = page.GetEditor()
            editor.BeginEdit(CPDFEditType.EditText)

            Dim textArea = editor.CreateTextArea()
            textArea.SetText("CONFIDENTIAL")
            textArea.SetFontSize(48)
            textArea.SetTransparency(128)

            editor.EndEdit()
            page.Release()
        Next

        document.WriteToFilePath("watermarked.pdf")
        document.Release()
    End Sub
End Module
$vbLabelText   $csharpLabel

Wdrożenie IronPDF:

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

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

        pdf.ApplyWatermark("<h1 style='color:rgba(255,0,0,0.3);'>CONFIDENTIAL</h1>",
            rotation: 45,
            verticalAlignment: VerticalAlignment.Middle,
            horizontalAlignment: HorizontalAlignment.Center);

        pdf.SaveAs("watermarked.pdf");
    }
}
// NuGet: Install-Package IronPdf
using IronPdf;
using IronPdf.Editing;
using System;

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

        pdf.ApplyWatermark("<h1 style='color:rgba(255,0,0,0.3);'>CONFIDENTIAL</h1>",
            rotation: 45,
            verticalAlignment: VerticalAlignment.Middle,
            horizontalAlignment: HorizontalAlignment.Center);

        pdf.SaveAs("watermarked.pdf");
    }
}
Imports IronPdf
Imports IronPdf.Editing
Imports System

Module Program
    Sub Main()
        Dim pdf = PdfDocument.FromFile("input.pdf")

        pdf.ApplyWatermark("<h1 style='color:rgba(255,0,0,0.3);'>CONFIDENTIAL</h1>", 
                           rotation:=45, 
                           verticalAlignment:=VerticalAlignment.Middle, 
                           horizontalAlignment:=HorizontalAlignment.Center)

        pdf.SaveAs("watermarked.pdf")
    End Sub
End Module
$vbLabelText   $csharpLabel

IronPDF redukuje implementację znaku wodnego składającego się z ponad 20 wierszy do pojedynczego wywołania metody ze stylizacją HTML/CSS. Aby uzyskać więcej opcji, zapoznaj się z dokumentacją dotyczącą znaków wodnych.

Wyodrębnianie tekstu

Wdrożenie ComPDFKit:

using ComPDFKit.PDFDocument;
using System.Text;

var document = CPDFDocument.InitWithFilePath("document.pdf");

// Extract text (verbose)
var allText = new StringBuilder();
for (int i = 0; i < document.PageCount; i++)
{
    var page = document.PageAtIndex(i);
    var textPage = page.GetTextPage();
    allText.AppendLine(textPage.GetText(0, textPage.CountChars()));
    textPage.Release();
    page.Release();
}

document.WriteToFilePath("output.pdf");
document.Release(); // Must remember to release!
using ComPDFKit.PDFDocument;
using System.Text;

var document = CPDFDocument.InitWithFilePath("document.pdf");

// Extract text (verbose)
var allText = new StringBuilder();
for (int i = 0; i < document.PageCount; i++)
{
    var page = document.PageAtIndex(i);
    var textPage = page.GetTextPage();
    allText.AppendLine(textPage.GetText(0, textPage.CountChars()));
    textPage.Release();
    page.Release();
}

document.WriteToFilePath("output.pdf");
document.Release(); // Must remember to release!
Imports ComPDFKit.PDFDocument
Imports System.Text

Dim document = CPDFDocument.InitWithFilePath("document.pdf")

' Extract text (verbose)
Dim allText As New StringBuilder()
For i As Integer = 0 To document.PageCount - 1
    Dim page = document.PageAtIndex(i)
    Dim textPage = page.GetTextPage()
    allText.AppendLine(textPage.GetText(0, textPage.CountChars()))
    textPage.Release()
    page.Release()
Next

document.WriteToFilePath("output.pdf")
document.Release() ' Must remember to release!
$vbLabelText   $csharpLabel

Wdrożenie IronPDF:

using IronPdf;

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

// Extract text (one-liner)
string allText = pdf.ExtractAllText();

pdf.SaveAs("output.pdf");
// No Release() needed - GC handles cleanup
using IronPdf;

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

// Extract text (one-liner)
string allText = pdf.ExtractAllText();

pdf.SaveAs("output.pdf");
// No Release() needed - GC handles cleanup
Imports IronPdf

Dim pdf = PdfDocument.FromFile("document.pdf")

' Extract text (one-liner)
Dim allText As String = pdf.ExtractAllText()

pdf.SaveAs("output.pdf")
' No Release() needed - GC handles cleanup
$vbLabelText   $csharpLabel

IronPDF redukuje wielowierszowe wyciąganie tekstu z ręcznych wywołań Release() do jednej metody. Aby uzyskać więcej opcji ekstrakcji, zapoznaj się z dokumentacją dotyczącą ekstrakcji tekstu.

Ochrona hasłem

Wdrożenie IronPDF:

using IronPdf;

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

// Set security
pdf.SecuritySettings.UserPassword = "userPassword";
pdf.SecuritySettings.OwnerPassword = "ownerPassword";
pdf.SecuritySettings.AllowUserPrinting = PdfPrintSecurity.FullPrintRights;
pdf.SecuritySettings.AllowUserCopyPasteContent = false;

pdf.SaveAs("protected.pdf");
using IronPdf;

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

// Set security
pdf.SecuritySettings.UserPassword = "userPassword";
pdf.SecuritySettings.OwnerPassword = "ownerPassword";
pdf.SecuritySettings.AllowUserPrinting = PdfPrintSecurity.FullPrintRights;
pdf.SecuritySettings.AllowUserCopyPasteContent = false;

pdf.SaveAs("protected.pdf");
Imports IronPdf

Dim renderer As New ChromePdfRenderer()
Dim pdf = renderer.RenderHtmlAsPdf("<h1>Confidential Document</h1>")

' Set security
pdf.SecuritySettings.UserPassword = "userPassword"
pdf.SecuritySettings.OwnerPassword = "ownerPassword"
pdf.SecuritySettings.AllowUserPrinting = PdfPrintSecurity.FullPrintRights
pdf.SecuritySettings.AllowUserCopyPasteContent = False

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

Aby uzyskać informacje na temat kompleksowych opcji bezpieczeństwa, zapoznaj się z dokumentacją dotyczącą szyfrowania.

Ważne uwagi dotyczące migracji

Usuń wszystkie wywołania Release()

Najbardziej znaczącą zmianą jest wyeliminowanie ręcznego zarządzania pamięcią.ComPDFKitwymaga wyraźnych wywołań Release() w odniesieniu do dokumentów, stron i stron tekstowych.IronPDFobsługuje to automatycznie poprzez mechanizm czyszczenia pamięci .NET:

//ComPDFKit- manual cleanup required
document.Release();
page.Release();
textPage.Release();

//IronPDF- no equivalent needed
// GC handles cleanup automatically
//ComPDFKit- manual cleanup required
document.Release();
page.Release();
textPage.Release();

//IronPDF- no equivalent needed
// GC handles cleanup automatically
'ComPDFKit- manual cleanup required
document.Release()
page.Release()
textPage.Release()

'IronPDF- no equivalent needed
' GC handles cleanup automatically
$vbLabelText   $csharpLabel

Renderowanie natywnego HTML

ComPDFKit wymaga ręcznego umieszczania tekstu za pomocą interfejsów API edytora.IronPDFrenderuje HTML/CSS natywnie za pomocą silnika Chromium, obsługując nowoczesny CSS3, JavaScript i responsywne układy.

Indeksowanie tej samej strony

Obie biblioteki używają indeksowania od 0 (Pages[0] to pierwsza strona) — nie trzeba zmieniać kodu dostępu do stron.

Uproszczone wyodrębnianie tekstu

Zastąp wielowierszowy wzorzec GetTextPage() + GetText() + Release() pojedynczym wywołaniem ExtractAllText().

Fluent Merge API

Zastąp ImportPagesAtIndex(doc2, "0-9", pageCount) prostym Merge(pdf1, pdf2).

Lista kontrolna po migracji

Po zakończeniu migracji kodu sprawdź, czy:

  • Uruchom wszystkie testy jednostkowe, aby sprawdzić, czy generowanie plików PDF działa poprawnie
  • Porównaj jakość wydruku PDF (silnik Chromium wIronPDFmoże renderować inaczej — zazwyczaj lepiej)
  • Przetestuj renderowanie HTML z użyciem złożonych arkuszy CSS i kodu JavaScript
  • Sprawdź dokładność wyodrębniania tekstu
  • Testowanie funkcjonalności formularza
  • Testy wydajności operacji wsadowych
  • Przetestuj we wszystkich środowiskach docelowych
  • Aktualizacja potoków CI/CD
  • Usuń pliki licencji ComPDFKit

Zabezpieczenie infrastruktury PDF na przyszłość

W obliczu zbliżającej się premiery .NET 10 i wprowadzenia nowych funkcji językowych w C# 14, wybór dojrzałej, aktywnie utrzymywanej biblioteki PDF zapewnia długoterminową kompatybilność. Ponad 10-letnie doświadczenie IronPDF, szerokie wsparcie społeczności oraz nowoczesna konstrukcja API oznaczają, że inwestycja w migrację przyniesie korzyści w miarę rozszerzania się projektów w latach 2025 i 2026.

Dodatkowe zasoby


Przejście zComPDFKitnaIronPDFeliminuje ręczne zarządzanie pamięcią za pomocą wywołań Release(), zapewniając jednocześnie natywne renderowanie HTML do PDF, którego brakuje w ComPDFKit. Przejście na dojrzały ekosystemIronPDFzapewnia szczegółową dokumentację, wsparcie społeczności oraz sprawdzoną stabilność, których wymagają projekty Enterprise.

Curtis Chau
Autor tekstów technicznych

Curtis Chau posiada tytuł licencjata z informatyki (Uniwersytet Carleton) i specjalizuje się w front-endowym rozwoju, z ekspertką w Node.js, TypeScript, JavaScript i React. Pasjonuje się tworzeniem intuicyjnych i estetycznie przyjemnych interfejsów użytkownika, Curtis cieszy się pracą z nowoczesnymi frameworkami i tworzeniem dobrze zorganizowanych, atrakcyjnych wizualnie podrę...

Czytaj więcej

Zespol wsparcia Iron

Jestesmy online 24 godziny, 5 dni w tygodniu.
Czat
Email
Zadzwon do mnie