Przejdź do treści stopki
PORóWNANIA PRODUKTóW

IronPDF vs ExpertPDF: Która biblioteka PDF C# powinna być wybrana przez starszych deweloperów .NET?

IronPDF wyróżnia się w konwersji HTML do PDF dzięki precyzji silnika Chrome V8 i intuicyjnym interfejsom API, podczas gdy ExpertPDF oferuje podstawowe funkcje PDF z bardziej złożonymi wymaganiami konfiguracyjnymi dla systemów produkcyjnych .NET.

Programiści C# często napotykają trudności podczas pracy z plikami PDF, czy to przy odczytywaniu, zapisywaniu, tworzeniu, czy konwertowaniu między formatami. Powstało wiele bibliotek, które zaspokajają te potrzeby, oferując płynną integrację z aplikacjami C#. Podczas tworzenia raportów PDF w języku C# wybór odpowiedniej biblioteki ma znaczący wpływ na czas rozwoju i jakość wyników. Aby w pełni generować pliki PDF w języku C#, niezbędne jest zrozumienie możliwości bibliotek.

W tym artykule porównano dwie biblioteki PDF dla programistów .NET:

Obie biblioteki udostępniają metody generowania, konwertowania i edycji plików PDF w środowiskach .NET. Kluczową kwestią jest określenie, która biblioteka najlepiej odpowiada konkretnym wymaganiom projektu. Niniejsza analiza podkreśla kluczowe cechy, które pomogą w podjęciu decyzji. Niezależnie od tego, czy chodzi o konwersję HTML do PDF, edycję plików PDF czy funkcje porządkowania dokumentów, kluczowe znaczenie ma wybór odpowiedniej biblioteki.

Czym jest biblioteka IronPDF?

IronPDF zapewnia kompletne rozwiązanie do obsługi plików PDF w środowisku .NET, szczególnie przydatne dla programistów C#. Biblioteka umożliwia implementację wszystkich niezbędnych funkcji PDF w aplikacjach napisanych w języku C#. Biblioteka obsługuje wdrażanie w Azure i AWS Lambda, dzięki czemu nadaje się do architektur natywnych dla chmury. Programiści korzystają z doskonałej obsługi systemu Windows, możliwości wdrażania w systemie Linux oraz kompatybilności z systemem macOS. Przegląd instalacji zawiera kompletne wskazówki dotyczące konfiguracji.

IronPDF zawiera silnik .NET Chromium, który renderuje zawartość HTML do formatu PDF, upraszczając projektowanie dokumentów bez skomplikowanych interfejsów API. Konwerter HTML na PDF tworzy dokumenty przy użyciu HTML5, CSS, JavaScript i obrazów. Ponadto programiści mogą edytować pliki PDF, dodawać nagłówki i stopki oraz wyodrębniać obrazy. Biblioteka ułatwia czytanie tekstu dzięki niezawodnym funkcjom wyodrębniania tekstu. W środowiskach produkcyjnych silnik renderujący Chrome zapewnia dokładne renderowanie.

Jakie są kluczowe funkcje IronPDF?

Jak utworzyć pliki PDF z HTML?

Jak edytować pliki PDF bez programu Adobe Acrobat Reader?

Jak edytować dokumenty PDF?

Jakie formaty plików mogę konwertować do PDF?

Jak zapisać i wydrukować pliki PDF?

Czym jest ExpertPDF?

Odwiedź oficjalną stronę ExpertPDF, aby zapoznać się z ich biblioteką .NET umożliwiającą konwersję HTML do PDF. Biblioteka umożliwia generowanie raportów w formacie PDF bez konieczności stosowania skomplikowanego oprogramowania do raportowania. Programiści poszukujący kompletnej dokumentacji i Dokumentacji API powinni rozważyć użycie IronPDF zamiast ExpertPDF, aby uzyskać znacznie większą dostępność zasobów.

ExpertPDF zapewnia proste funkcje edycji plików PDF. Konwerter HTML na PDF szybko integruje się z aplikacjami .NET. Kompatybilny z .NET Framework, .NET Core, .NET 5 i .NET 6, choć brakuje wsparcia dla wdrożeń w systemie Linux i macOS. W przypadku wdrożeń kontenerowych IronPDF oferuje obsługę Docker, podczas gdy ExpertPDF nie. IronPDF obsługuje również zdalne wdrażanie kontenerów oraz opcje silnika natywnego i zdalnego.

Ta biblioteka tworzy pliki PDF na podstawie adresów URL stron internetowych lub surowego kodu HTML w aplikacjach .NET. W przypadku zaawansowanych scenariuszy, takich jak renderowanie stron WebGL lub aplikacji intensywnie wykorzystujących JavaScript, IronPDF zapewnia doskonałe możliwości renderowania. Przewodnik szybkiego startu pomaga programistom szybko rozpocząć pracę.

Jakie są kluczowe funkcje ExpertPDF?

Do najważniejszych funkcji należą:

  • Konwersja stron internetowych z adresów URL do formatu PDF
  • Konwersja ciągów znaków HTML do formatu PDF
  • Wiele opcji plików wyjściowych
  • Ustaw marginesy i rozmiar strony
  • Ustaw nagłówki i stopki
  • Dodaj automatyczne i niestandardowe podziały stron
  • Konwersja określonych części stron internetowych do formatu PDF
  • Ukryj elementy podczas konwersji
  • Łączenie wielu stron internetowych w pojedyncze pliki PDF
  • Konwersja uwierzytelnionych stron internetowych do formatu PDF
  • Wybierz typ mediów CSS do renderowania
  • Obsługa zakładek
  • Obsługa podpisów cyfrowych
  • Pobieranie pozycji elementów HTML w pliku PDF
  • Obsługa HTML5/CSS3
  • Obsługa czcionek internetowych
  • Konwersje typów plików:
    • Konwerter plików PDF na tekst
    • Konwerter HTML na PDF
    • Konwerter HTML na obraz
    • Konwerter plików PDF na obrazy
    • Konwerter RTF na PDF

Poniższe sekcje obejmują:

  1. Utwórz projekt konsolowy
  2. Instalacja IronPDF
  3. Instalacja ExpertPDF
  4. Utwórz plik PDF z adresu URL
  5. Tworzenie pliku PDF na podstawie ciągu znaków HTML
  6. Łączenie wielu plików PDF w jeden plik PDF
  7. Konwersja obrazów do formatu PDF
  8. Licencjonowanie i ceny
  9. Podsumowanie

Jak utworzyć projekt konsolowy?

Wykonaj poniższe kroki, aby utworzyć aplikację konsolową przy użyciu programu Visual Studio 2022:

  • Otwórz program Visual Studio 2022 i kliknij opcję utworzenia nowego projektu

    Visual Studio 2022 welcome screen with dark theme interface showing four primary development options: Clone a repository for collaborative projects, Open a project or solution for existing work, Open a local folder for file exploration, and Create a new project for starting fresh development

  • Wybierz aplikację konsolową C# i kliknij Dalej

    Visual Studio's Create a new project dialog showcasing various .NET project templates with cross-platform support indicators for Windows, Linux, and macOS, featuring Console App, Class Library, and MSTest Test Project options with language and project type filters

  • Wpisz nazwę projektu i kliknij Dalej

    Visual Studio project configuration window displaying setup options for a new cross-platform C# Console Application named 'DemoApp' with platform targeting choices for Linux, macOS, Windows, and console environments

  • Wybierz wersję .NET Framework (używając najnowszej 6.0)

    Visual Studio project creation wizard showing the Additional information step with Console App template selected and .NET 6.0 framework chosen, displaying cross-platform support tags for C#, Linux, macOS, Windows, and Console applications

Projekt konsoli został utworzony i jest gotowy do testowania biblioteki. Obie biblioteki wymagają instalacji przed użyciem. Więcej szczegółów można znaleźć w przewodniku szybkiego startu. Dokumentacja ogólna zawiera kompletne informacje.

Jak zainstalować IronPDF?

Dostępnych jest wiele metod instalacji:

  1. Korzystanie z programu Visual Studio
  2. Pobierz pakiet NuGet bezpośrednio
  3. Pobierz bibliotekę IronPDF .DLL

Więcej szczegółów można znaleźć w przeglądzie instalacji. Biblioteka obsługuje instalator Windows do wdrażania w całym systemie. Opcje zaawansowane obejmują instalację NuGet i korzystanie z kluczy licencyjnych.

Jak zainstalować za pomocą Visual Studio?

Visual Studio udostępnia menedżera pakietów NuGet do instalowania pakietów:

  • Dostęp poprzez menu Projekt > Narzędzia lub
  • Kliknij prawym przyciskiem myszy projekt w Eksploratorze rozwiązań

    Visual Studio Solution Explorer context menu displaying various project management options with the 'Manage NuGet Packages' option prominently highlighted for easy access to package management functionality

    Visual Studio IDE Tools menu expanded to show the NuGet Package Manager submenu featuring 'Manage NuGet Packages for Solution' option for centralized dependency management across all projects in the solution

Wyszukaj pakiet IronPDF NuGet i zainstaluj go. Więcej szczegółów można znaleźć w instrukcji instalacji NuGet. Przewodniki dotyczące konkretnych platform obejmują integrację z systemem Android, programowanie w języku F# oraz wykorzystanie VB.NET. Aby rozwiązać problemy z wdrażaniem, zapoznaj się z przewodnikiem dotyczącym nieudanego wdrożenia pakietu NuGet.

Jak bezpośrednio pobrać pakiet NuGet?

Pobierz IronPDF ze strony NuGet:

  • Odwiedź pakiet NuGet IronPDF
  • Wybierz "Pobierz pakiet"
  • Kliknij dwukrotnie pobrany pakiet
  • Pakiet instaluje się automatycznie
  • Odśwież Visual Studio

Jak pobrać i zainstalować bibliotekę DLL IronPDF?

Pobierz plik IronPDF .DLL bezpośrednio ze strony internetowej IronPDF. Kliknij Pobierz bibliotekę DLL IronPDF.

Odwołaj się do IronPDF w projekcie:

  • Kliknij prawym przyciskiem myszy Solution w Solution Explorer
  • Wybierz "Dodaj odwołanie"
  • Wyszukaj bibliotekę IronPDF.dll
  • Kliknij OK

Instalacja IronPDF została zakończona. Aby uzyskać informacje na temat dodatkowych opcji, w tym wdrażania w środowisku Docker i konfiguracji silnika zdalnego, zapoznaj się z przeglądem instalacji. W celu rozwiązania problemów zapoznaj się z krótkim przewodnikiem dotyczącym rozwiązywania problemów lub zapoznaj się z wydajnością wstępnego renderowania i optymalizacją procesów GPU. Przewodnik po folderze runtimes pomaga w zarządzaniu zależnościami.

Jak zainstalować ExpertPDF?

Istnieją dwie metody instalacji:

  • Korzystanie z menedżera pakietów NuGet w Visual Studio
  • Pobieranie zestawów (starsze wersje .NET)

Zainstaluj ExpertPDF za pomocą menedżera pakietów NuGet dla nowoczesnych frameworków .NET Framework. Rozważ użycie IronPDF zamiast ExpertPDF, aby uzyskać znacznie większą elastyczność dzięki zaawansowanym metodom instalacji i optymalizacji rozmiaru pakietu.

Jak zainstalować za pomocą menedżera pakietów NuGet w Visual Studio?

Dostęp do menedżera pakietów NuGet:

  • Menu projektu Narzędzia
  • Kliknij prawym przyciskiem myszy projekt w Eksploratorze rozwiązań

    Visual Studio NuGet Package Manager interface showing IronPDF package search results with multiple library versions, download counts (3.88M for main package), and installation options for various platforms and rendering engines

    Visual Studio Solution Explorer context menu with the 'Manage NuGet Packages' option highlighted in the Add submenu, providing quick access to package management and dependency installation features

Znajdź pakiet ExpertPDF NuGet i zainstaluj go. Aby usprawnić konfigurację, warto zapoznać się z przewodnikiem IronPDF dotyczącym deklaracji użycia.

Uwaga: ExpertPDF obsługuje tylko system Windows, natomiast IronPDF obsługuje systemy Windows, Linux i macOS. W przypadku wdrożeń w chmurze IronPDF oferuje integrację z platformą Azure oraz obsługę AWS Lambda. IronPDF zapewnia kompleksowe wskazówki dotyczące optymalizacji wydajności i zarządzania pamięcią. W przypadku konkretnych platform zobacz obsługę Red Hat Enterprise Linux oraz AWS Lambda na Amazon Linux 2.

Jak utworzyć plik PDF z adresu URL?

Obie biblioteki konwertują HTML na PDF. Więcej szczegółów można znaleźć w przewodniku "URL to PDF". Złożone strony internetowe mogą wymagać niestandardowych opóźnień renderowania lub obsługi wykonywania kodu JavaScript. W przypadku witryn wymagających uwierzytelnienia zapoznaj się z przewodnikiem dotyczącym logowania do witryn i systemów TLS. IronPDF wyróżnia się perfekcyjną konwersją HTML do PDF z wykorzystaniem renderowania Chrome.

W jaki sposób IronPDF konwertuje adresy URL na pliki PDF?

IronPDF wydajnie renderuje HTML z adresów URL do formatu PDF. Biblioteka zapewnia zaawansowaną obsługę CSS, JavaScript, obrazów i formularzy. Wykorzystanie silnika renderującego Chrome zapewnia konwersję HTML do PDF z idealną dokładnością pikselową. W przypadku problemów z renderowaniem zapoznaj się z przewodnikiem po formatowaniu HTML zapewniającym idealną rozdzielczość. Zaawansowane opcje renderowania obejmują niestandardowe rozmiary papieru i konfigurację okna wyświetlania. Moduł nasłuchujący komunikatów JavaScript umożliwia dynamiczną obsługę treści.

Ten przykład kodu pokazuje, w jaki sposób IronPDF umożliwia programistom tworzenie plików PDF na podstawie adresów URL stron internetowych:

// Import the IronPdf library
using IronPdf;

// Initialize a new renderer
ChromePdfRenderer renderer = new ChromePdfRenderer();
// Render the specified URL as a PDF
var pdf = renderer.RenderUrlAsPdf("___PROTECTED_URL_190___");
// Save the rendered PDF to a file
pdf.SaveAs("url.pdf");
// Import the IronPdf library
using IronPdf;

// Initialize a new renderer
ChromePdfRenderer renderer = new ChromePdfRenderer();
// Render the specified URL as a PDF
var pdf = renderer.RenderUrlAsPdf("___PROTECTED_URL_190___");
// Save the rendered PDF to a file
pdf.SaveAs("url.pdf");
' Import the IronPdf library
Imports IronPdf

' Initialize a new renderer
Dim renderer As New ChromePdfRenderer()
' Render the specified URL as a PDF
Dim pdf = renderer.RenderUrlAsPdf("___PROTECTED_URL_190___")
' Save the rendered PDF to a file
pdf.SaveAs("url.pdf")
$vbLabelText   $csharpLabel

W przypadku adresów URL wymagających uwierzytelnienia zapoznaj się z przewodnikiem dotyczącym logowania do witryn i systemów TLS. Skonfiguruj pliki cookie i niestandardowe nagłówki HTTP dla uwierzytelnionych żądań. Witryny zabezpieczone mogą wymagać uwierzytelniania Kerberos. W celu debugowania należy skorzystać z przewodnika po debugowaniu w przeglądarce Chrome. Dodatkowe przykłady pokazują konwersję adresów URL do formatu PDF.

W jaki sposób ExpertPDF konwertuje adresy URL na pliki PDF?

ExpertPDF converts URLs using savePdfFromUrlToFile method, preserving page formatting:

// Import the ExpertPdf.HtmlToPdf namespace
using ExpertPdf.HtmlToPdf;

// Initialize a new PdfConverter
PdfConverter pdfConverter = new PdfConverter();
// Use PdfConverter to save a webpage URL directly to a PDF file
pdfConverter.SavePdfFromUrlToFile("___PROTECTED_URL_191___", "output.pdf");
// Import the ExpertPdf.HtmlToPdf namespace
using ExpertPdf.HtmlToPdf;

// Initialize a new PdfConverter
PdfConverter pdfConverter = new PdfConverter();
// Use PdfConverter to save a webpage URL directly to a PDF file
pdfConverter.SavePdfFromUrlToFile("___PROTECTED_URL_191___", "output.pdf");
' Import the ExpertPdf.HtmlToPdf namespace
Imports ExpertPdf.HtmlToPdf

' Initialize a new PdfConverter
Dim pdfConverter As New PdfConverter()
' Use PdfConverter to save a webpage URL directly to a PDF file
pdfConverter.SavePdfFromUrlToFile("___PROTECTED_URL_191___", "output.pdf")
$vbLabelText   $csharpLabel

W tle IronPDF wykorzystuje silnik renderujący Chrome, aby zapewnić lepszą obsługę HTML5 i CSS3.

Jak utworzyć plik PDF na podstawie ciągu znaków HTML?

Obie biblioteki tworzą pliki PDF na podstawie ciągów znaków HTML. Więcej szczegółów można znaleźć w przewodniku dotyczącym konwersji ciągów znaków HTML do formatu PDF. Należy używać CSS dla ekranu i PRINT oraz wykorzystać czcionki internetowe i czcionki ikon. IronPDF zapewnia doskonałą obsługę Bootstrap i Flexbox CSS. Przykład tworzenia pliku PDF przy użyciu HTML ilustruje praktyczne zastosowanie.

W jaki sposób IronPDF konwertuje ciąg znaków HTML na plik PDF?

Ten przykład kodu pokazuje, w jaki sposób IronPDF umożliwia programistom generowanie dokumentów PDF na podstawie ciągów znaków HTML:

// Import the IronPdf library
using IronPdf;

// Initialize a new renderer
ChromePdfRenderer renderer = new ChromePdfRenderer();
// Render a PDF from HTML string and save it
var pdfDoc1 = renderer.RenderHtmlAsPdf("<h1>Html with CSS and Images</h1>");
pdfDoc1.SaveAs("pixel-perfect.pdf");

// Render HTML with external assets and save it
var pdfDoc2 = renderer.RenderHtmlAsPdf("<img src='icons/iron.png'>", @"C:\site\assets\");
pdfDoc2.SaveAs("html-with-assets.pdf");
// Import the IronPdf library
using IronPdf;

// Initialize a new renderer
ChromePdfRenderer renderer = new ChromePdfRenderer();
// Render a PDF from HTML string and save it
var pdfDoc1 = renderer.RenderHtmlAsPdf("<h1>Html with CSS and Images</h1>");
pdfDoc1.SaveAs("pixel-perfect.pdf");

// Render HTML with external assets and save it
var pdfDoc2 = renderer.RenderHtmlAsPdf("<img src='icons/iron.png'>", @"C:\site\assets\");
pdfDoc2.SaveAs("html-with-assets.pdf");
' Import the IronPdf library
Imports IronPdf

' Initialize a new renderer
Private renderer As New ChromePdfRenderer()
' Render a PDF from HTML string and save it
Private pdfDoc1 = renderer.RenderHtmlAsPdf("<h1>Html with CSS and Images</h1>")
pdfDoc1.SaveAs("pixel-perfect.pdf")

' Render HTML with external assets and save it
Dim pdfDoc2 = renderer.RenderHtmlAsPdf("<img src='icons/iron.png'>", "C:\site\assets\")
pdfDoc2.SaveAs("html-with-assets.pdf")
$vbLabelText   $csharpLabel

IronPDF obsługuje adresy URL bazowe dla ścieżek względnych oraz DataURI do osadzania obrazów. W przypadku złożonego kodu HTML zapoznaj się z przewodnikiem dotyczącym konwersji plików HTML do formatu PDF. W przypadku konkretnych okienek wyświetlania należy zapoznać się z przewodnikiem po ustawieniach okienek wyświetlania i Zoomie. Biblioteka płynnie obsługuje języki międzynarodowe i kodowanie UTF-8. Zaawansowane funkcje obejmują ustawienia renderowania HTML oraz responsywną konwersję HTML do formatu PDF.

W jaki sposób ExpertPDF konwertuje ciąg znaków HTML na plik PDF?

Konwerter ExpertPDF HTML na PDF obsługuje konwersję ciągów znaków HTML:

// Import the ExpertPdf.HtmlToPdf namespace
using ExpertPdf.HtmlToPdf;

// Initialize a new PdfConverter
PdfConverter pdfConverter = new PdfConverter();
// Use PdfConverter to save an HTML string to a PDF file
pdfConverter.SavePdfFromHtmlStringToFile("<h1>PDF using Expert PDF</h1>", "html-to-pdf.pdf");
// Import the ExpertPdf.HtmlToPdf namespace
using ExpertPdf.HtmlToPdf;

// Initialize a new PdfConverter
PdfConverter pdfConverter = new PdfConverter();
// Use PdfConverter to save an HTML string to a PDF file
pdfConverter.SavePdfFromHtmlStringToFile("<h1>PDF using Expert PDF</h1>", "html-to-pdf.pdf");
' Import the ExpertPdf.HtmlToPdf namespace
Imports ExpertPdf.HtmlToPdf

' Initialize a new PdfConverter
Private pdfConverter As New PdfConverter()
' Use PdfConverter to save an HTML string to a PDF file
pdfConverter.SavePdfFromHtmlStringToFile("<h1>PDF using Expert PDF</h1>", "html-to-pdf.pdf")
$vbLabelText   $csharpLabel

Pierwszy argument określa ciąg znaków HTML, drugi określa nazwę pliku wyjściowego. Warto rozważyć wykorzystanie obsługi Unicode i UTF-8 przez IronPDF zamiast podstawowego renderowania HTML, aby uzyskać znacznie większą obsługę języków międzynarodowych.

Jak mogę wygenerować pliki PDF z dokumentacją techniczną?

Dokumentacja techniczna zyskuje dzięki uporządkowanemu układowi z przykładami kodu. Ta demonstracja Bootstrap 5 pokazuje możliwości IronPDF w zakresie renderowania dokumentacji z podświetleniem składni i alertami. Refer to the Bootstrap and Flexbox CSS support guide for more details. IronPDF supports font management and font kerning for professional typography. For improve results, check fonts troubleshooting guide and international languages support.

using IronPdf;

var renderer = new ChromePdfRenderer();

string technicalDocs = @"
<!DOCTYPE html>
<html>
<head>
    <meta charset='utf-8'>
    <link href='___PROTECTED_URL_192___ rel='stylesheet'>
    <style>
        .code-block { background: #f8f9fa; border-left: 3px solid #0d6efd; padding: 15px; border-radius: 4px; }
        .api-method { font-family: 'Courier New', monospace; color: #0d6efd; }
        @media print { .card, .alert { page-break-inside: avoid; } }
    </style>
</head>
<body class='bg-light'>
    <div class='container py-4'>
        <div class='card shadow-sm mb-4'>
            <div class='card-header bg-dark text-white'>
                <h2 class='mb-0'>API Reference - HTML to PDF Conversion</h2>
            </div>
            <div class='card-body'>
                <h4>RenderHtmlAsPdf() Method</h4>
                <p class='lead'>Converts HTML content to PDF with full CSS3 and JavaScript support.</p>

                <div class='code-block mb-3'>
                    <code class='api-method'>PdfDocument RenderHtmlAsPdf(string htmlContent)</code>
                </div>

                <div class='row mt-4'>
                    <div class='col-md-6'>
                        <h5 class='text-primary'>Parameters</h5>
                        <table class='table table-sm table-bordered'>
                            <tr>
                                <td><code>htmlContent</code></td>
                                <td>String containing HTML to convert</td>
                            </tr>
                        </table>
                    </div>
                    <div class='col-md-6'>
                        <h5 class='text-success'>Returns</h5>
                        <table class='table table-sm table-bordered'>
                            <tr>
                                <td><code>PdfDocument</code></td>
                                <td>Generated PDF document object</td>
                            </tr>
                        </table>
                    </div>
                </div>
            </div>
        </div>

        <div class='row g-3 mb-4'>
            <div class='col-md-4'>
                <div class='alert alert-success mb-0'>
                    <h6 class='alert-heading'>✓ Supported Features</h6>
                    <ul class='mb-0 small'>
                        <li>HTML5 semantic tags</li>
                        <li>CSS3 with Flexbox/Grid</li>
                        <li>JavaScript execution</li>
                        <li>External stylesheets</li>
                    </ul>
                </div>
            </div>
            <div class='col-md-4'>
                <div class='alert alert-info mb-0'>
                    <h6 class='alert-heading'>ⓘ Rendering Engine</h6>
                    <ul class='mb-0 small'>
                        <li>Chrome V8 Engine</li>
                        <li>98% browser fidelity</li>
                        <li>Sub-second rendering</li>
                        <li>Async/await support</li>
                    </ul>
                </div>
            </div>
            <div class='col-md-4'>
                <div class='alert alert-warning mb-0'>
                    <h6 class='alert-heading'>⚠ ExpertPDF Notes</h6>
                    <ul class='mb-0 small'>
                        <li>Complex API structure</li>
                        <li>Limited CSS3 support</li>
                        <li>No native JavaScript</li>
                        <li>Requires configuration</li>
                    </ul>
                </div>
            </div>
        </div>

        <div class='card shadow-sm'>
            <div class='card-header bg-primary text-white'>
                <h5 class='mb-0'>Code Example Comparison</h5>
            </div>
            <div class='card-body'>
                <div class='row'>
                    <div class='col-md-6'>
                        <h6 class='text-primary'>IronPDF (Simple)</h6>
                        <div class='code-block'>
                            <pre class='mb-0'><code>var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderHtmlAsPdf(html);
pdf.SaveAs("output.pdf");</code></pre>
                        </div>
                        <div class='badge bg-success mt-2'>3 Lines</div>
                    </div>
                    <div class='col-md-6'>
                        <h6 class='text-warning'>ExpertPDF (Complex)</h6>
                        <div class='code-block'>
                            <pre class='mb-0'><code>var converter = new HtmlToPdfConverter();
converter.PdfDocumentOptions.PdfPageSize = PdfPageSize.A4;
converter.NavigationTimeout = 60;
byte[] result = converter.GetPdfBytesFromHtmlString(html);
File.WriteAllBytes("output.pdf", result);</code></pre>
                        </div>
                        <div class='badge bg-warning text-dark mt-2'>5+ Lines</div>
                    </div>
                </div>
            </div>
            <div class='card-footer text-muted'>
                <small><strong>Comparison:</strong> IronPDF provides a more intuitive API with less configuration overhead for common use cases.</small>
            </div>
        </div>
    </div>
</body>
</html>";

var pdf = renderer.RenderHtmlAsPdf(technicalDocs);
pdf.SaveAs("technical-documentation.pdf");
using IronPdf;

var renderer = new ChromePdfRenderer();

string technicalDocs = @"
<!DOCTYPE html>
<html>
<head>
    <meta charset='utf-8'>
    <link href='___PROTECTED_URL_192___ rel='stylesheet'>
    <style>
        .code-block { background: #f8f9fa; border-left: 3px solid #0d6efd; padding: 15px; border-radius: 4px; }
        .api-method { font-family: 'Courier New', monospace; color: #0d6efd; }
        @media print { .card, .alert { page-break-inside: avoid; } }
    </style>
</head>
<body class='bg-light'>
    <div class='container py-4'>
        <div class='card shadow-sm mb-4'>
            <div class='card-header bg-dark text-white'>
                <h2 class='mb-0'>API Reference - HTML to PDF Conversion</h2>
            </div>
            <div class='card-body'>
                <h4>RenderHtmlAsPdf() Method</h4>
                <p class='lead'>Converts HTML content to PDF with full CSS3 and JavaScript support.</p>

                <div class='code-block mb-3'>
                    <code class='api-method'>PdfDocument RenderHtmlAsPdf(string htmlContent)</code>
                </div>

                <div class='row mt-4'>
                    <div class='col-md-6'>
                        <h5 class='text-primary'>Parameters</h5>
                        <table class='table table-sm table-bordered'>
                            <tr>
                                <td><code>htmlContent</code></td>
                                <td>String containing HTML to convert</td>
                            </tr>
                        </table>
                    </div>
                    <div class='col-md-6'>
                        <h5 class='text-success'>Returns</h5>
                        <table class='table table-sm table-bordered'>
                            <tr>
                                <td><code>PdfDocument</code></td>
                                <td>Generated PDF document object</td>
                            </tr>
                        </table>
                    </div>
                </div>
            </div>
        </div>

        <div class='row g-3 mb-4'>
            <div class='col-md-4'>
                <div class='alert alert-success mb-0'>
                    <h6 class='alert-heading'>✓ Supported Features</h6>
                    <ul class='mb-0 small'>
                        <li>HTML5 semantic tags</li>
                        <li>CSS3 with Flexbox/Grid</li>
                        <li>JavaScript execution</li>
                        <li>External stylesheets</li>
                    </ul>
                </div>
            </div>
            <div class='col-md-4'>
                <div class='alert alert-info mb-0'>
                    <h6 class='alert-heading'>ⓘ Rendering Engine</h6>
                    <ul class='mb-0 small'>
                        <li>Chrome V8 Engine</li>
                        <li>98% browser fidelity</li>
                        <li>Sub-second rendering</li>
                        <li>Async/await support</li>
                    </ul>
                </div>
            </div>
            <div class='col-md-4'>
                <div class='alert alert-warning mb-0'>
                    <h6 class='alert-heading'>⚠ ExpertPDF Notes</h6>
                    <ul class='mb-0 small'>
                        <li>Complex API structure</li>
                        <li>Limited CSS3 support</li>
                        <li>No native JavaScript</li>
                        <li>Requires configuration</li>
                    </ul>
                </div>
            </div>
        </div>

        <div class='card shadow-sm'>
            <div class='card-header bg-primary text-white'>
                <h5 class='mb-0'>Code Example Comparison</h5>
            </div>
            <div class='card-body'>
                <div class='row'>
                    <div class='col-md-6'>
                        <h6 class='text-primary'>IronPDF (Simple)</h6>
                        <div class='code-block'>
                            <pre class='mb-0'><code>var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderHtmlAsPdf(html);
pdf.SaveAs("output.pdf");</code></pre>
                        </div>
                        <div class='badge bg-success mt-2'>3 Lines</div>
                    </div>
                    <div class='col-md-6'>
                        <h6 class='text-warning'>ExpertPDF (Complex)</h6>
                        <div class='code-block'>
                            <pre class='mb-0'><code>var converter = new HtmlToPdfConverter();
converter.PdfDocumentOptions.PdfPageSize = PdfPageSize.A4;
converter.NavigationTimeout = 60;
byte[] result = converter.GetPdfBytesFromHtmlString(html);
File.WriteAllBytes("output.pdf", result);</code></pre>
                        </div>
                        <div class='badge bg-warning text-dark mt-2'>5+ Lines</div>
                    </div>
                </div>
            </div>
            <div class='card-footer text-muted'>
                <small><strong>Comparison:</strong> IronPDF provides a more intuitive API with less configuration overhead for common use cases.</small>
            </div>
        </div>
    </div>
</body>
</html>";

var pdf = renderer.RenderHtmlAsPdf(technicalDocs);
pdf.SaveAs("technical-documentation.pdf");
Imports IronPdf

Dim renderer = New ChromePdfRenderer()

Dim technicalDocs As String = "
<!DOCTYPE html>
<html>
<head>
    <meta charset='utf-8'>
    <link href='___PROTECTED_URL_192___ rel='stylesheet'>
    <style>
        .code-block { background: #f8f9fa; border-left: 3px solid #0d6efd; padding: 15px; border-radius: 4px; }
        .api-method { font-family: 'Courier New', monospace; color: #0d6efd; }
        @media print { .card, .alert { page-break-inside: avoid; } }
    </style>
</head>
<body class='bg-light'>
    <div class='container py-4'>
        <div class='card shadow-sm mb-4'>
            <div class='card-header bg-dark text-white'>
                <h2 class='mb-0'>API Reference - HTML to PDF Conversion</h2>
            </div>
            <div class='card-body'>
                <h4>RenderHtmlAsPdf() Method</h4>
                <p class='lead'>Converts HTML content to PDF with full CSS3 and JavaScript support.</p>

                <div class='code-block mb-3'>
                    <code class='api-method'>PdfDocument RenderHtmlAsPdf(string htmlContent)</code>
                </div>

                <div class='row mt-4'>
                    <div class='col-md-6'>
                        <h5 class='text-primary'>Parameters</h5>
                        <table class='table table-sm table-bordered'>
                            <tr>
                                <td><code>htmlContent</code></td>
                                <td>String containing HTML to convert</td>
                            </tr>
                        </table>
                    </div>
                    <div class='col-md-6'>
                        <h5 class='text-success'>Returns</h5>
                        <table class='table table-sm table-bordered'>
                            <tr>
                                <td><code>PdfDocument</code></td>
                                <td>Generated PDF document object</td>
                            </tr>
                        </table>
                    </div>
                </div>
            </div>
        </div>

        <div class='row g-3 mb-4'>
            <div class='col-md-4'>
                <div class='alert alert-success mb-0'>
                    <h6 class='alert-heading'>✓ Supported Features</h6>
                    <ul class='mb-0 small'>
                        <li>HTML5 semantic tags</li>
                        <li>CSS3 with Flexbox/Grid</li>
                        <li>JavaScript execution</li>
                        <li>External stylesheets</li>
                    </ul>
                </div>
            </div>
            <div class='col-md-4'>
                <div class='alert alert-info mb-0'>
                    <h6 class='alert-heading'>ⓘ Rendering Engine</h6>
                    <ul class='mb-0 small'>
                        <li>Chrome V8 Engine</li>
                        <li>98% browser fidelity</li>
                        <li>Sub-second rendering</li>
                        <li>Async/await support</li>
                    </ul>
                </div>
            </div>
            <div class='col-md-4'>
                <div class='alert alert-warning mb-0'>
                    <h6 class='alert-heading'>⚠ ExpertPDF Notes</h6>
                    <ul class='mb-0 small'>
                        <li>Complex API structure</li>
                        <li>Limited CSS3 support</li>
                        <li>No native JavaScript</li>
                        <li>Requires configuration</li>
                    </ul>
                </div>
            </div>
        </div>

        <div class='card shadow-sm'>
            <div class='card-header bg-primary text-white'>
                <h5 class='mb-0'>Code Example Comparison</h5>
            </div>
            <div class='card-body'>
                <div class='row'>
                    <div class='col-md-6'>
                        <h6 class='text-primary'>IronPDF (Simple)</h6>
                        <div class='code-block'>
                            <pre class='mb-0'><code>var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderHtmlAsPdf(html);
pdf.SaveAs("output.pdf");</code></pre>
                        </div>
                        <div class='badge bg-success mt-2'>3 Lines</div>
                    </div>
                    <div class='col-md-6'>
                        <h6 class='text-warning'>ExpertPDF (Complex)</h6>
                        <div class='code-block'>
                            <pre class='mb-0'><code>var converter = new HtmlToPdfConverter();
converter.PdfDocumentOptions.PdfPageSize = PdfPageSize.A4;
converter.NavigationTimeout = 60;
byte[] result = converter.GetPdfBytesFromHtmlString(html);
File.WriteAllBytes("output.pdf", result);</code></pre>
                        </div>
                        <div class='badge bg-warning text-dark mt-2'>5+ Lines</div>
                    </div>
                </div>
            </div>
            <div class='card-footer text-muted'>
                <small><strong>Comparison:</strong> IronPDF provides a more intuitive API with less configuration overhead for common use cases.</small>
            </div>
        </div>
    </div>
</body>
</html>"

Dim pdf = renderer.RenderHtmlAsPdf(technicalDocs)
pdf.SaveAs("technical-documentation.pdf")
$vbLabelText   $csharpLabel

Output: A professional technical documentation PDF with Bootstrap 5 cards, alerts, tables, and code blocks. IronPDF accurately renders all typography, spacing utilities, and grid layouts, demonstrating superior documentation generation capabilities.

How Can I Create Financial Reports with Complex Layouts?

Financial reporting requires precise table formatting and calculations. This example demonstrates IronPDF's complex financial layout rendering with CSS Grid and dynamic JavaScript. Refer to the JavaScript in PDFs guide including custom JavaScript execution for more details. Financial documents may need PDF compression for file optimization and metadata management for compliance. The rendering charts in PDFs guide helps with data visualization.

using IronPdf;

var renderer = new ChromePdfRenderer();
// Enable JavaScript for dynamic calculations
renderer.RenderingOptions.EnableJavaScript = true;
renderer.RenderingOptions.RenderDelay = 500; // Allow JS to execute

string financialReport = @"
<!DOCTYPE html>
<html>
<head>
    <meta charset='utf-8'>
    <style>
        @page { size: A4; margin: 20mm; }
        body { font-family: Arial, sans-serif; line-height: 1.6; }
        .header { text-align: center; margin-bottom: 30px; }
        .financial-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 10px; margin-bottom: 20px; }
        .grid-header { background: #2c3e50; color: white; padding: 10px; font-weight: bold; }
        .grid-row { padding: 10px; border-bottom: 1px solid #ddd; }
        .grid-row:hover { background: #f9f9f9; }
        .amount { text-align: right; font-family: 'Courier New', monospace; }
        .positive { color: #27ae60; }
        .negative { color: #e74c3c; }
        .total-row { background: #ecf0f1; font-weight: bold; margin-top: 10px; }
        .footer-note { font-size: 0.8em; color: #666; margin-top: 30px; text-align: center; }
        @media print { 
            .grid-row:hover { background: transparent; }
            .financial-grid { page-break-inside: avoid; }
        }
    </style>
</head>
<body>
    <div class='header'>
        <h1>Quarterly Financial Report</h1>
        <p>Q4 2023 - Consolidated Statement</p>
    </div>

    <div class='financial-grid'>
        <div class='grid-header'>Revenue Stream</div>
        <div class='grid-header amount'>Q3 2023</div>
        <div class='grid-header amount'>Q4 2023</div>

        <div class='grid-row'>Software Licenses</div>
        <div class='grid-row amount'>$2,150,000</div>
        <div class='grid-row amount positive'>$2,875,000</div>

        <div class='grid-row'>Support Services</div>
        <div class='grid-row amount'>$850,000</div>
        <div class='grid-row amount positive'>$975,000</div>

        <div class='grid-row'>Consulting</div>
        <div class='grid-row amount'>$425,000</div>
        <div class='grid-row amount negative'>$380,000</div>

        <div class='grid-row total-row'>Total Revenue</div>
        <div class='grid-row total-row amount'>$3,425,000</div>
        <div class='grid-row total-row amount positive' id='total'>$4,230,000</div>
    </div>

    <div class='financial-grid'>
        <div class='grid-header'>Operating Expenses</div>
        <div class='grid-header amount'>Q3 2023</div>
        <div class='grid-header amount'>Q4 2023</div>

        <div class='grid-row'>R&D</div>
        <div class='grid-row amount'>$1,200,000</div>
        <div class='grid-row amount'>$1,350,000</div>

        <div class='grid-row'>Sales & Marketing</div>
        <div class='grid-row amount'>$800,000</div>
        <div class='grid-row amount'>$950,000</div>

        <div class='grid-row'>General & Admin</div>
        <div class='grid-row amount'>$400,000</div>
        <div class='grid-row amount'>$425,000</div>

        <div class='grid-row total-row'>Total Expenses</div>
        <div class='grid-row total-row amount'>$2,400,000</div>
        <div class='grid-row total-row amount'>$2,725,000</div>
    </div>

    <script>
        // Calculate growth percentage
        const q3Total = 3425000;
        const q4Total = 4230000;
        const growth = ((q4Total - q3Total) / q3Total * 100).toFixed(1);

        // Add growth indicator
        const totalEl = document.getElementById('total');
        totalEl.innerHTML += ` <small>(+${growth}%)</small>`;
    </script>

    <div class='footer-note'>
        <p>This report was generated using IronPDF's advanced rendering engine.<br>
        All financial figures are in USD. Report generated on: <span id='date'></span></p>
    </div>

    <script>
        document.getElementById('date').textContent = new Date().toLocaleDateString();
    </script>
</body>
</html>";

var pdf = renderer.RenderHtmlAsPdf(financialReport);
pdf.SaveAs("financial-report.pdf");
using IronPdf;

var renderer = new ChromePdfRenderer();
// Enable JavaScript for dynamic calculations
renderer.RenderingOptions.EnableJavaScript = true;
renderer.RenderingOptions.RenderDelay = 500; // Allow JS to execute

string financialReport = @"
<!DOCTYPE html>
<html>
<head>
    <meta charset='utf-8'>
    <style>
        @page { size: A4; margin: 20mm; }
        body { font-family: Arial, sans-serif; line-height: 1.6; }
        .header { text-align: center; margin-bottom: 30px; }
        .financial-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 10px; margin-bottom: 20px; }
        .grid-header { background: #2c3e50; color: white; padding: 10px; font-weight: bold; }
        .grid-row { padding: 10px; border-bottom: 1px solid #ddd; }
        .grid-row:hover { background: #f9f9f9; }
        .amount { text-align: right; font-family: 'Courier New', monospace; }
        .positive { color: #27ae60; }
        .negative { color: #e74c3c; }
        .total-row { background: #ecf0f1; font-weight: bold; margin-top: 10px; }
        .footer-note { font-size: 0.8em; color: #666; margin-top: 30px; text-align: center; }
        @media print { 
            .grid-row:hover { background: transparent; }
            .financial-grid { page-break-inside: avoid; }
        }
    </style>
</head>
<body>
    <div class='header'>
        <h1>Quarterly Financial Report</h1>
        <p>Q4 2023 - Consolidated Statement</p>
    </div>

    <div class='financial-grid'>
        <div class='grid-header'>Revenue Stream</div>
        <div class='grid-header amount'>Q3 2023</div>
        <div class='grid-header amount'>Q4 2023</div>

        <div class='grid-row'>Software Licenses</div>
        <div class='grid-row amount'>$2,150,000</div>
        <div class='grid-row amount positive'>$2,875,000</div>

        <div class='grid-row'>Support Services</div>
        <div class='grid-row amount'>$850,000</div>
        <div class='grid-row amount positive'>$975,000</div>

        <div class='grid-row'>Consulting</div>
        <div class='grid-row amount'>$425,000</div>
        <div class='grid-row amount negative'>$380,000</div>

        <div class='grid-row total-row'>Total Revenue</div>
        <div class='grid-row total-row amount'>$3,425,000</div>
        <div class='grid-row total-row amount positive' id='total'>$4,230,000</div>
    </div>

    <div class='financial-grid'>
        <div class='grid-header'>Operating Expenses</div>
        <div class='grid-header amount'>Q3 2023</div>
        <div class='grid-header amount'>Q4 2023</div>

        <div class='grid-row'>R&D</div>
        <div class='grid-row amount'>$1,200,000</div>
        <div class='grid-row amount'>$1,350,000</div>

        <div class='grid-row'>Sales & Marketing</div>
        <div class='grid-row amount'>$800,000</div>
        <div class='grid-row amount'>$950,000</div>

        <div class='grid-row'>General & Admin</div>
        <div class='grid-row amount'>$400,000</div>
        <div class='grid-row amount'>$425,000</div>

        <div class='grid-row total-row'>Total Expenses</div>
        <div class='grid-row total-row amount'>$2,400,000</div>
        <div class='grid-row total-row amount'>$2,725,000</div>
    </div>

    <script>
        // Calculate growth percentage
        const q3Total = 3425000;
        const q4Total = 4230000;
        const growth = ((q4Total - q3Total) / q3Total * 100).toFixed(1);

        // Add growth indicator
        const totalEl = document.getElementById('total');
        totalEl.innerHTML += ` <small>(+${growth}%)</small>`;
    </script>

    <div class='footer-note'>
        <p>This report was generated using IronPDF's advanced rendering engine.<br>
        All financial figures are in USD. Report generated on: <span id='date'></span></p>
    </div>

    <script>
        document.getElementById('date').textContent = new Date().toLocaleDateString();
    </script>
</body>
</html>";

var pdf = renderer.RenderHtmlAsPdf(financialReport);
pdf.SaveAs("financial-report.pdf");
Imports IronPdf

Dim renderer As New ChromePdfRenderer()
' Enable JavaScript for dynamic calculations
renderer.RenderingOptions.EnableJavaScript = True
renderer.RenderingOptions.RenderDelay = 500 ' Allow JS to execute

Dim financialReport As String = "
<!DOCTYPE html>
<html>
<head>
    <meta charset='utf-8'>
    <style>
        @page { size: A4; margin: 20mm; }
        body { font-family: Arial, sans-serif; line-height: 1.6; }
        .header { text-align: center; margin-bottom: 30px; }
        .financial-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 10px; margin-bottom: 20px; }
        .grid-header { background: #2c3e50; color: white; padding: 10px; font-weight: bold; }
        .grid-row { padding: 10px; border-bottom: 1px solid #ddd; }
        .grid-row:hover { background: #f9f9f9; }
        .amount { text-align: right; font-family: 'Courier New', monospace; }
        .positive { color: #27ae60; }
        .negative { color: #e74c3c; }
        .total-row { background: #ecf0f1; font-weight: bold; margin-top: 10px; }
        .footer-note { font-size: 0.8em; color: #666; margin-top: 30px; text-align: center; }
        @media print { 
            .grid-row:hover { background: transparent; }
            .financial-grid { page-break-inside: avoid; }
        }
    </style>
</head>
<body>
    <div class='header'>
        <h1>Quarterly Financial Report</h1>
        <p>Q4 2023 - Consolidated Statement</p>
    </div>

    <div class='financial-grid'>
        <div class='grid-header'>Revenue Stream</div>
        <div class='grid-header amount'>Q3 2023</div>
        <div class='grid-header amount'>Q4 2023</div>

        <div class='grid-row'>Software Licenses</div>
        <div class='grid-row amount'>$2,150,000</div>
        <div class='grid-row amount positive'>$2,875,000</div>

        <div class='grid-row'>Support Services</div>
        <div class='grid-row amount'>$850,000</div>
        <div class='grid-row amount positive'>$975,000</div>

        <div class='grid-row'>Consulting</div>
        <div class='grid-row amount'>$425,000</div>
        <div class='grid-row amount negative'>$380,000</div>

        <div class='grid-row total-row'>Total Revenue</div>
        <div class='grid-row total-row amount'>$3,425,000</div>
        <div class='grid-row total-row amount positive' id='total'>$4,230,000</div>
    </div>

    <div class='financial-grid'>
        <div class='grid-header'>Operating Expenses</div>
        <div class='grid-header amount'>Q3 2023</div>
        <div class='grid-header amount'>Q4 2023</div>

        <div class='grid-row'>R&D</div>
        <div class='grid-row amount'>$1,200,000</div>
        <div class='grid-row amount'>$1,350,000</div>

        <div class='grid-row'>Sales & Marketing</div>
        <div class='grid-row amount'>$800,000</div>
        <div class='grid-row amount'>$950,000</div>

        <div class='grid-row'>General & Admin</div>
        <div class='grid-row amount'>$400,000</div>
        <div class='grid-row amount'>$425,000</div>

        <div class='grid-row total-row'>Total Expenses</div>
        <div class='grid-row total-row amount'>$2,400,000</div>
        <div class='grid-row total-row amount'>$2,725,000</div>
    </div>

    <script>
        // Calculate growth percentage
        const q3Total = 3425000;
        const q4Total = 4230000;
        const growth = ((q4Total - q3Total) / q3Total * 100).toFixed(1);

        // Add growth indicator
        const totalEl = document.getElementById('total');
        totalEl.innerHTML += ` <small>(+${growth}%)</small>`;
    </script>

    <div class='footer-note'>
        <p>This report was generated using IronPDF's advanced rendering engine.<br>
        All financial figures are in USD. Report generated on: <span id='date'></span></p>
    </div>

    <script>
        document.getElementById('date').textContent = new Date().toLocaleDateString();
    </script>
</body>
</html>"

Dim pdf = renderer.RenderHtmlAsPdf(financialReport)
pdf.SaveAs("financial-report.pdf")
$vbLabelText   $csharpLabel

This code example shows how IronPDF allows developers to use CSS Grid layouts, JavaScript execution, and print-specific CSS. Add custom headers and footers to reports, implement backgrounds and foregrounds for branding, watermarks for security, and digital signatures for authentication. Refer to the generate PDF reports guide for more details.

How Do I Merge Multiple PDF Files into a Single PDF?

Both libraries merge multiple PDFs into single documents, consolidating data for efficient transmission. Refer to the merge or split PDFs guide for more details. Multi-page documents may require page management or splitting multipage PDFs. For large file performance, consider async PDF generation or parallel processing. The merge two or more PDFs example provides practical implementation. For organizing PDFs, IronPDF offers complete tools.

W jaki sposób IronPDF łączy pliki PDF?

This code example shows how IronPDF allows developers to render two PDFs from HTML strings and merge them. The straightforward approach offers additional settings options. For page numbers and page breaks in merged documents, see respective guides. Also copy pages between PDFs for granular control. For forms, see form management and edit forms documentation. The page numbers and page breaks example shows combined implementation.

// Import the IronPdf library
using IronPdf;

// Define HTML strings to convert to PDF
var htmlA = @"<p> [PDF_A] </p>
        <p> [PDF_A] 1st Page </p>
        <div style='page-break-after: always;'></div>
        <p> [PDF_A] 2nd Page</p>";

var htmlB = @"<p> [PDF_B] </p>
        <p> [PDF_B] 1st Page </p>
        <div style='page-break-after: always;'></div>
        <p> [PDF_B] 2nd Page</p>";

// Initialize a new renderer
var renderer = new ChromePdfRenderer();

// Render HTML strings as PDFs
var pdfDocA = renderer.RenderHtmlAsPdf(htmlA);
var pdfDocB = renderer.RenderHtmlAsPdf(htmlB);

// Merge the PDF documents
var mergedPdf = PdfDocument.Merge(pdfDocA, pdfDocB);

// Save the merged PDF
mergedPdf.SaveAs("Merged.pdf");
// Import the IronPdf library
using IronPdf;

// Define HTML strings to convert to PDF
var htmlA = @"<p> [PDF_A] </p>
        <p> [PDF_A] 1st Page </p>
        <div style='page-break-after: always;'></div>
        <p> [PDF_A] 2nd Page</p>";

var htmlB = @"<p> [PDF_B] </p>
        <p> [PDF_B] 1st Page </p>
        <div style='page-break-after: always;'></div>
        <p> [PDF_B] 2nd Page</p>";

// Initialize a new renderer
var renderer = new ChromePdfRenderer();

// Render HTML strings as PDFs
var pdfDocA = renderer.RenderHtmlAsPdf(htmlA);
var pdfDocB = renderer.RenderHtmlAsPdf(htmlB);

// Merge the PDF documents
var mergedPdf = PdfDocument.Merge(pdfDocA, pdfDocB);

// Save the merged PDF
mergedPdf.SaveAs("Merged.pdf");
' Import the IronPdf library
Imports IronPdf

' Define HTML strings to convert to PDF
Private htmlA = "<p> [PDF_A] </p>
        <p> [PDF_A] 1st Page </p>
        <div style='page-break-after: always;'></div>
        <p> [PDF_A] 2nd Page</p>"

Private htmlB = "<p> [PDF_B] </p>
        <p> [PDF_B] 1st Page </p>
        <div style='page-break-after: always;'></div>
        <p> [PDF_B] 2nd Page</p>"

' Initialize a new renderer
Private renderer = New ChromePdfRenderer()

' Render HTML strings as PDFs
Private pdfDocA = renderer.RenderHtmlAsPdf(htmlA)
Private pdfDocB = renderer.RenderHtmlAsPdf(htmlB)

' Merge the PDF documents
Private mergedPdf = PdfDocument.Merge(pdfDocA, pdfDocB)

' Save the merged PDF
mergedPdf.SaveAs("Merged.pdf")
$vbLabelText   $csharpLabel

The Merge method accepts multiple documents as Enumerable objects. See IronPDF Code Example for Merging PDFs. For adding cover pages or creating table of contents, see specialized guides. Also stamp new content or add attachments. The split a PDF and extract pages example demonstrates reverse operations.

Note that merged PDFs containing editable forms have form field names appended with index numbers. Refer to the form data handling guide for more details.

How Does ExpertPDF Merge PDF Files?

ExpertPDF uses a Merge PDF component requiring separate installation. The AppendPDFFile method appends files to PDFMerge objects:

// Import the ExpertPdf.MergePdf namespace
using ExpertPdf.MergePdf;

// Initialize a new PDFMerge object
PDFMerge pdfMerge = new PDFMerge();
// Append PDF files to the merge object
pdfMerge.AppendPDFFile("output.pdf");
pdfMerge.AppendPDFFile("html-to-pdf.pdf");
// Save the merged PDF to a file
pdfMerge.SaveMergedPDFToFile("merged.pdf");
// Import the ExpertPdf.MergePdf namespace
using ExpertPdf.MergePdf;

// Initialize a new PDFMerge object
PDFMerge pdfMerge = new PDFMerge();
// Append PDF files to the merge object
pdfMerge.AppendPDFFile("output.pdf");
pdfMerge.AppendPDFFile("html-to-pdf.pdf");
// Save the merged PDF to a file
pdfMerge.SaveMergedPDFToFile("merged.pdf");
' Import the ExpertPdf.MergePdf namespace
Imports ExpertPdf.MergePdf

' Initialize a new PDFMerge object
Private pdfMerge As New PDFMerge()
' Append PDF files to the merge object
pdfMerge.AppendPDFFile("output.pdf")
pdfMerge.AppendPDFFile("html-to-pdf.pdf")
' Save the merged PDF to a file
pdfMerge.SaveMergedPDFToFile("merged.pdf")
$vbLabelText   $csharpLabel

Behind the scenes, IronPDF use more efficient merging algorithms. Consider using IronPDF's async PDF generation and multi-threaded generation in place of synchronous operations for far greater performance.

How Can I Implement Advanced PDF Merging with Document Organization?

Enterprise applications require advanced features like bookmarks, page organization, and metadata preservation when merging PDFs. This example demonstrates bookmark management, metadata handling, and document organization. For compliance, implement revision history, PDF/A conversion, and PDF/UA accessibility. The outlines & bookmarks example provides additional implementation details. Refer to the set & edit metadata guide and metadata visibility troubleshooting for more details.

using IronPdf;
using System.Collections.Generic;
using System.Linq;

public class AdvancedPdfMerger
{
    public static void MergeDocumentsWithBookmarks()
    {
        var renderer = new ChromePdfRenderer();
        var documentsToMerge = new List<PdfDocument>();

        // Create chapter PDFs with proper structure
        string[] chapters = { "Introduction", "Technical Overview", "Implementation", "Conclusion" };

        foreach (var chapter in chapters)
        {
            string html = $@"
                <html>
                <head>
                    <style>
                        body {{ font-family: Georgia, serif; margin: 40px; }}
                        h1 {{ color: #2c3e50; border-bottom: 2px solid #3498db; padding-bottom: 10px; }}
                        .chapter-number {{ color: #7f8c8d; font-size: 0.8em; }}
                    </style>
                </head>
                <body>
                    <h1><span class='chapter-number'>Chapter {Array.IndexOf(chapters, chapter) + 1}</span><br>{chapter}</h1>
                    <p>This is the content for the {chapter} chapter. In a real document, this would contain 
                    extensive content, diagrams, and detailed explanations.</p>
                    <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor 
                    incididunt ut labore et dolore magna aliqua.</p>
                </body>
                </html>";

            var pdf = renderer.RenderHtmlAsPdf(html);

            // Add metadata to each chapter
            pdf.MetaData.Title = $"Chapter: {chapter}";
            pdf.MetaData.Author = "Technical Documentation Team";
            pdf.MetaData.Subject = "Enterprise PDF Generation";

            documentsToMerge.Add(pdf);
        }

        // Create a table of contents
        string tocHtml = @"
            <html>
            <head>
                <style>
                    body { font-family: Georgia, serif; margin: 40px; }
                    h1 { text-align: center; color: #2c3e50; margin-bottom: 40px; }
                    .toc-entry { margin: 15px 0; font-size: 1.1em; }
                    .toc-entry a { text-decoration: none; color: #3498db; }
                    .page-number { float: right; color: #7f8c8d; }
                </style>
            </head>
            <body>
                <h1>Table of Contents</h1>";

        int pageNumber = 2; // Starting after TOC page
        foreach (var chapter in chapters)
        {
            tocHtml += $@"
                <div class='toc-entry'>
                    <a href='#'>Chapter {Array.IndexOf(chapters, chapter) + 1}: {chapter}</a>
                    <span class='page-number'>{pageNumber}</span>
                </div>";
            pageNumber += 2; // Assuming each chapter is 2 pages
        }

        tocHtml += @"
            </body>
            </html>";

        var tocPdf = renderer.RenderHtmlAsPdf(tocHtml);

        // Merge all documents with TOC first
        var allDocuments = new List<PdfDocument> { tocPdf };
        allDocuments.AddRange(documentsToMerge);

        var finalPdf = PdfDocument.Merge(allDocuments);

        // Add bookmarks for navigation
        finalPdf.BookMarks.AddBookMarkAtStart("Table of Contents", 0);
        int currentPage = 1; // After TOC
        foreach (var chapter in chapters)
        {
            finalPdf.BookMarks.AddBookMarkAtStart($"Chapter {Array.IndexOf(chapters, chapter) + 1}: {chapter}", currentPage);
            currentPage += 2;
        }

        // Set document properties
        finalPdf.MetaData.Title = "Complete Technical Documentation";
        finalPdf.MetaData.Keywords = "IronPDF, Documentation, Enterprise, .NET";
        finalPdf.MetaData.CreationDate = System.DateTime.Now;

        // Add page numbers to footer
        finalPdf.AddTextFooters("Page {page} of {total-pages}", 
            new ChromePdfRenderer.ChromePdfRenderOptions() 
            { 
                MarginBottom = 20,
                MarginLeft = 50,
                MarginRight = 50
            });

        finalPdf.SaveAs("advanced-merged-document.pdf");
    }
}
using IronPdf;
using System.Collections.Generic;
using System.Linq;

public class AdvancedPdfMerger
{
    public static void MergeDocumentsWithBookmarks()
    {
        var renderer = new ChromePdfRenderer();
        var documentsToMerge = new List<PdfDocument>();

        // Create chapter PDFs with proper structure
        string[] chapters = { "Introduction", "Technical Overview", "Implementation", "Conclusion" };

        foreach (var chapter in chapters)
        {
            string html = $@"
                <html>
                <head>
                    <style>
                        body {{ font-family: Georgia, serif; margin: 40px; }}
                        h1 {{ color: #2c3e50; border-bottom: 2px solid #3498db; padding-bottom: 10px; }}
                        .chapter-number {{ color: #7f8c8d; font-size: 0.8em; }}
                    </style>
                </head>
                <body>
                    <h1><span class='chapter-number'>Chapter {Array.IndexOf(chapters, chapter) + 1}</span><br>{chapter}</h1>
                    <p>This is the content for the {chapter} chapter. In a real document, this would contain 
                    extensive content, diagrams, and detailed explanations.</p>
                    <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor 
                    incididunt ut labore et dolore magna aliqua.</p>
                </body>
                </html>";

            var pdf = renderer.RenderHtmlAsPdf(html);

            // Add metadata to each chapter
            pdf.MetaData.Title = $"Chapter: {chapter}";
            pdf.MetaData.Author = "Technical Documentation Team";
            pdf.MetaData.Subject = "Enterprise PDF Generation";

            documentsToMerge.Add(pdf);
        }

        // Create a table of contents
        string tocHtml = @"
            <html>
            <head>
                <style>
                    body { font-family: Georgia, serif; margin: 40px; }
                    h1 { text-align: center; color: #2c3e50; margin-bottom: 40px; }
                    .toc-entry { margin: 15px 0; font-size: 1.1em; }
                    .toc-entry a { text-decoration: none; color: #3498db; }
                    .page-number { float: right; color: #7f8c8d; }
                </style>
            </head>
            <body>
                <h1>Table of Contents</h1>";

        int pageNumber = 2; // Starting after TOC page
        foreach (var chapter in chapters)
        {
            tocHtml += $@"
                <div class='toc-entry'>
                    <a href='#'>Chapter {Array.IndexOf(chapters, chapter) + 1}: {chapter}</a>
                    <span class='page-number'>{pageNumber}</span>
                </div>";
            pageNumber += 2; // Assuming each chapter is 2 pages
        }

        tocHtml += @"
            </body>
            </html>";

        var tocPdf = renderer.RenderHtmlAsPdf(tocHtml);

        // Merge all documents with TOC first
        var allDocuments = new List<PdfDocument> { tocPdf };
        allDocuments.AddRange(documentsToMerge);

        var finalPdf = PdfDocument.Merge(allDocuments);

        // Add bookmarks for navigation
        finalPdf.BookMarks.AddBookMarkAtStart("Table of Contents", 0);
        int currentPage = 1; // After TOC
        foreach (var chapter in chapters)
        {
            finalPdf.BookMarks.AddBookMarkAtStart($"Chapter {Array.IndexOf(chapters, chapter) + 1}: {chapter}", currentPage);
            currentPage += 2;
        }

        // Set document properties
        finalPdf.MetaData.Title = "Complete Technical Documentation";
        finalPdf.MetaData.Keywords = "IronPDF, Documentation, Enterprise, .NET";
        finalPdf.MetaData.CreationDate = System.DateTime.Now;

        // Add page numbers to footer
        finalPdf.AddTextFooters("Page {page} of {total-pages}", 
            new ChromePdfRenderer.ChromePdfRenderOptions() 
            { 
                MarginBottom = 20,
                MarginLeft = 50,
                MarginRight = 50
            });

        finalPdf.SaveAs("advanced-merged-document.pdf");
    }
}
Imports IronPdf
Imports System.Collections.Generic
Imports System.Linq

Public Class AdvancedPdfMerger
    Public Shared Sub MergeDocumentsWithBookmarks()
        Dim renderer As New ChromePdfRenderer()
        Dim documentsToMerge As New List(Of PdfDocument)()

        ' Create chapter PDFs with proper structure
        Dim chapters As String() = {"Introduction", "Technical Overview", "Implementation", "Conclusion"}

        For Each chapter In chapters
            Dim html As String = $"
                <html>
                <head>
                    <style>
                        body {{ font-family: Georgia, serif; margin: 40px; }}
                        h1 {{ color: #2c3e50; border-bottom: 2px solid #3498db; padding-bottom: 10px; }}
                        .chapter-number {{ color: #7f8c8d; font-size: 0.8em; }}
                    </style>
                </head>
                <body>
                    <h1><span class='chapter-number'>Chapter {Array.IndexOf(chapters, chapter) + 1}</span><br>{chapter}</h1>
                    <p>This is the content for the {chapter} chapter. In a real document, this would contain 
                    extensive content, diagrams, and detailed explanations.</p>
                    <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor 
                    incididunt ut labore et dolore magna aliqua.</p>
                </body>
                </html>"

            Dim pdf As PdfDocument = renderer.RenderHtmlAsPdf(html)

            ' Add metadata to each chapter
            pdf.MetaData.Title = $"Chapter: {chapter}"
            pdf.MetaData.Author = "Technical Documentation Team"
            pdf.MetaData.Subject = "Enterprise PDF Generation"

            documentsToMerge.Add(pdf)
        Next

        ' Create a table of contents
        Dim tocHtml As String = "
            <html>
            <head>
                <style>
                    body { font-family: Georgia, serif; margin: 40px; }
                    h1 { text-align: center; color: #2c3e50; margin-bottom: 40px; }
                    .toc-entry { margin: 15px 0; font-size: 1.1em; }
                    .toc-entry a { text-decoration: none; color: #3498db; }
                    .page-number { float: right; color: #7f8c8d; }
                </style>
            </head>
            <body>
                <h1>Table of Contents</h1>"

        Dim pageNumber As Integer = 2 ' Starting after TOC page
        For Each chapter In chapters
            tocHtml += $"
                <div class='toc-entry'>
                    <a href='#'>Chapter {Array.IndexOf(chapters, chapter) + 1}: {chapter}</a>
                    <span class='page-number'>{pageNumber}</span>
                </div>"
            pageNumber += 2 ' Assuming each chapter is 2 pages
        Next

        tocHtml += "
            </body>
            </html>"

        Dim tocPdf As PdfDocument = renderer.RenderHtmlAsPdf(tocHtml)

        ' Merge all documents with TOC first
        Dim allDocuments As New List(Of PdfDocument) From {tocPdf}
        allDocuments.AddRange(documentsToMerge)

        Dim finalPdf As PdfDocument = PdfDocument.Merge(allDocuments)

        ' Add bookmarks for navigation
        finalPdf.BookMarks.AddBookMarkAtStart("Table of Contents", 0)
        Dim currentPage As Integer = 1 ' After TOC
        For Each chapter In chapters
            finalPdf.BookMarks.AddBookMarkAtStart($"Chapter {Array.IndexOf(chapters, chapter) + 1}: {chapter}", currentPage)
            currentPage += 2
        Next

        ' Set document properties
        finalPdf.MetaData.Title = "Complete Technical Documentation"
        finalPdf.MetaData.Keywords = "IronPDF, Documentation, Enterprise, .NET"
        finalPdf.MetaData.CreationDate = DateTime.Now

        ' Add page numbers to footer
        finalPdf.AddTextFooters("Page {page} of {total-pages}",
            New ChromePdfRenderer.ChromePdfRenderOptions() With {
                .MarginBottom = 20,
                .MarginLeft = 50,
                .MarginRight = 50
            })

        finalPdf.SaveAs("advanced-merged-document.pdf")
    End Sub
End Class
$vbLabelText   $csharpLabel

This advanced implementation demonstrates bookmark management, metadata handling, and page numbering. Refer to the organize PDFs tutorial for more details. Explore PDF compression techniques after merging. For security, implement password protection and encryption. The add classic text headers & footers example provides formatting options. For additional features, explore add page numbers and add a table of contents guides. The passwords, security & metadata example shows integrated implementation.

How Do I Convert Images to PDF?

IronPDF converts various images to PDF, a feature unavailable in ExpertPDF. However, ExpertPDF extracts images from PDFs and converts PDFs to images, capabilities IronPDF also provides. Refer to the image to PDF guide for more details. IronPDF supports rasterizing PDFs to images and extracting text and images. For advanced scenarios, draw text and bitmaps or draw lines and rectangles. The images to PDF example demonstrates practical implementation. For image quality, see C# PDF to image without losing quality example.

W jaki sposób IronPDF konwertuje obrazy do formatu PDF?

Creating PDFs from images uses the ImageToPdfConverter class. Images load from any folder, supporting various formats including multi-page TIFF files. Also add images to existing PDFs or work with SVG graphics. For memory efficiency, use rasterize to images using MemoryStream. The custom PDF size example helps with layout control.

// Import the IronPdf namespace
using IronPdf;

// Specify the folder containing the image files
var imageFiles = System.IO.Directory.EnumerateFiles(@"C:\project\assets")
                  .Where(file => file.EndsWith(".jpg") || file.EndsWith(".jpeg"));

// Convert the images to a PDF document
var pdfDocument = ImageToPdfConverter.ImageToPdf(imageFiles);
// Save the PDF document
pdfDocument.SaveAs(@"C:\project\composite.pdf");
// Import the IronPdf namespace
using IronPdf;

// Specify the folder containing the image files
var imageFiles = System.IO.Directory.EnumerateFiles(@"C:\project\assets")
                  .Where(file => file.EndsWith(".jpg") || file.EndsWith(".jpeg"));

// Convert the images to a PDF document
var pdfDocument = ImageToPdfConverter.ImageToPdf(imageFiles);
// Save the PDF document
pdfDocument.SaveAs(@"C:\project\composite.pdf");
' Import the IronPdf namespace
Imports IronPdf

' Specify the folder containing the image files
Private imageFiles = System.IO.Directory.EnumerateFiles("C:\project\assets").Where(Function(file) file.EndsWith(".jpg") OrElse file.EndsWith(".jpeg"))

' Convert the images to a PDF document
Private pdfDocument = ImageToPdfConverter.ImageToPdf(imageFiles)
' Save the PDF document
pdfDocument.SaveAs("C:\project\composite.pdf")
$vbLabelText   $csharpLabel

Beyond converting images to PDF, IronPDF converts scanned documents and business documents to images using rasterize to images. The library also extracts images from various file types. Refer to the rasterizing to images using MemoryStream guide for memory operations. For large images, consider ImageToPDF file size optimization. The portrait & landscape orientation example helps with page setup. For advanced image handling, see embedding bitmaps and images example.

How Can I Create Advanced Image to PDF Conversions with Layout Control?

For controlled image placement and professional layouts, this photo album example demonstrates embedding images and layout creation. For cloud storage, see Azure Blob Storage images guide. The set grayscale example shows image processing options:

using IronPdf;
using System.IO;

public class PhotoAlbumCreator
{
    public static void CreatePhotoAlbum(string imagesFolder, string outputPath)
    {
        var renderer = new ChromePdfRenderer();
        renderer.RenderingOptions.PaperSize = IronPdf.Rendering.PdfPaperSize.A4;
        renderer.RenderingOptions.MarginTop = 20;
        renderer.RenderingOptions.MarginBottom = 20;
        renderer.RenderingOptions.MarginLeft = 20;
        renderer.RenderingOptions.MarginRight = 20;

        string htmlContent = @"
            <!DOCTYPE html>
            <html>
            <head>
                <style>
                    body { font-family: Arial, sans-serif; }
                    .album-title { text-align: center; font-size: 2em; margin-bottom: 30px; color: #2c3e50; }
                    .photo-container { margin-bottom: 30px; text-align: center; page-break-inside: avoid; }
                    .photo { max-width: 100%; max-height: 500px; box-shadow: 0 4px 6px rgba(0,0,0,0.1); }
                    .caption { margin-top: 10px; font-style: italic; color: #666; }
                    .page-break { page-break-after: always; }
                </style>
            </head>
            <body>
                <h1 class='album-title'>My Photo Album</h1>";

        var imageFiles = Directory.GetFiles(imagesFolder, "*.*")
            .Where(file => new[] { ".jpg", ".jpeg", ".png", ".gif" }
            .Contains(Path.GetExtension(file).ToLower()))
            .ToList();

        for (int i = 0; i < imageFiles.Count; i++)
        {
            string base64Image = Convert.ToBase64String(File.ReadAllBytes(imageFiles[i]));
            string fileName = Path.GetFileNameWithoutExtension(imageFiles[i]);

            htmlContent += $@"
                <div class='photo-container'>
                    <img class='photo' src='data:image/jpeg;base64,{base64Image}' alt='{fileName}'>
                    <div class='caption'>Photo {i + 1}: {fileName}</div>
                </div>";

            // Add page break every 2 photos
            if ((i + 1) % 2 == 0 && i < imageFiles.Count - 1)
            {
                htmlContent += "<div class='page-break'></div>";
            }
        }

        htmlContent += @"
                <div style='text-align: center; margin-top: 40px; color: #999;'>
                    <small>Created with IronPDF - Total Photos: " + imageFiles.Count + @"</small>
                </div>
            </body>
            </html>";

        var pdf = renderer.RenderHtmlAsPdf(htmlContent);
        pdf.SaveAs(outputPath);
    }
}

// Usage
PhotoAlbumCreator.CreatePhotoAlbum(@"C:\MyPhotos", @"C:\MyPhotoAlbum.pdf");
using IronPdf;
using System.IO;

public class PhotoAlbumCreator
{
    public static void CreatePhotoAlbum(string imagesFolder, string outputPath)
    {
        var renderer = new ChromePdfRenderer();
        renderer.RenderingOptions.PaperSize = IronPdf.Rendering.PdfPaperSize.A4;
        renderer.RenderingOptions.MarginTop = 20;
        renderer.RenderingOptions.MarginBottom = 20;
        renderer.RenderingOptions.MarginLeft = 20;
        renderer.RenderingOptions.MarginRight = 20;

        string htmlContent = @"
            <!DOCTYPE html>
            <html>
            <head>
                <style>
                    body { font-family: Arial, sans-serif; }
                    .album-title { text-align: center; font-size: 2em; margin-bottom: 30px; color: #2c3e50; }
                    .photo-container { margin-bottom: 30px; text-align: center; page-break-inside: avoid; }
                    .photo { max-width: 100%; max-height: 500px; box-shadow: 0 4px 6px rgba(0,0,0,0.1); }
                    .caption { margin-top: 10px; font-style: italic; color: #666; }
                    .page-break { page-break-after: always; }
                </style>
            </head>
            <body>
                <h1 class='album-title'>My Photo Album</h1>";

        var imageFiles = Directory.GetFiles(imagesFolder, "*.*")
            .Where(file => new[] { ".jpg", ".jpeg", ".png", ".gif" }
            .Contains(Path.GetExtension(file).ToLower()))
            .ToList();

        for (int i = 0; i < imageFiles.Count; i++)
        {
            string base64Image = Convert.ToBase64String(File.ReadAllBytes(imageFiles[i]));
            string fileName = Path.GetFileNameWithoutExtension(imageFiles[i]);

            htmlContent += $@"
                <div class='photo-container'>
                    <img class='photo' src='data:image/jpeg;base64,{base64Image}' alt='{fileName}'>
                    <div class='caption'>Photo {i + 1}: {fileName}</div>
                </div>";

            // Add page break every 2 photos
            if ((i + 1) % 2 == 0 && i < imageFiles.Count - 1)
            {
                htmlContent += "<div class='page-break'></div>";
            }
        }

        htmlContent += @"
                <div style='text-align: center; margin-top: 40px; color: #999;'>
                    <small>Created with IronPDF - Total Photos: " + imageFiles.Count + @"</small>
                </div>
            </body>
            </html>";

        var pdf = renderer.RenderHtmlAsPdf(htmlContent);
        pdf.SaveAs(outputPath);
    }
}

// Usage
PhotoAlbumCreator.CreatePhotoAlbum(@"C:\MyPhotos", @"C:\MyPhotoAlbum.pdf");
Imports IronPdf
Imports System.IO
Imports System.Linq

Public Class PhotoAlbumCreator
    Public Shared Sub CreatePhotoAlbum(imagesFolder As String, outputPath As String)
        Dim renderer = New ChromePdfRenderer()
        renderer.RenderingOptions.PaperSize = IronPdf.Rendering.PdfPaperSize.A4
        renderer.RenderingOptions.MarginTop = 20
        renderer.RenderingOptions.MarginBottom = 20
        renderer.RenderingOptions.MarginLeft = 20
        renderer.RenderingOptions.MarginRight = 20

        Dim htmlContent As String = "
            <!DOCTYPE html>
            <html>
            <head>
                <style>
                    body { font-family: Arial, sans-serif; }
                    .album-title { text-align: center; font-size: 2em; margin-bottom: 30px; color: #2c3e50; }
                    .photo-container { margin-bottom: 30px; text-align: center; page-break-inside: avoid; }
                    .photo { max-width: 100%; max-height: 500px; box-shadow: 0 4px 6px rgba(0,0,0,0.1); }
                    .caption { margin-top: 10px; font-style: italic; color: #666; }
                    .page-break { page-break-after: always; }
                </style>
            </head>
            <body>
                <h1 class='album-title'>My Photo Album</h1>"

        Dim imageFiles = Directory.GetFiles(imagesFolder, "*.*").Where(Function(file) New String() {".jpg", ".jpeg", ".png", ".gif"}.Contains(Path.GetExtension(file).ToLower())).ToList()

        For i As Integer = 0 To imageFiles.Count - 1
            Dim base64Image As String = Convert.ToBase64String(File.ReadAllBytes(imageFiles(i)))
            Dim fileName As String = Path.GetFileNameWithoutExtension(imageFiles(i))

            htmlContent += $"
                <div class='photo-container'>
                    <img class='photo' src='data:image/jpeg;base64,{base64Image}' alt='{fileName}'>
                    <div class='caption'>Photo {i + 1}: {fileName}</div>
                </div>"

            ' Add page break every 2 photos
            If (i + 1) Mod 2 = 0 AndAlso i < imageFiles.Count - 1 Then
                htmlContent += "<div class='page-break'></div>"
            End If
        Next

        htmlContent += "
                <div style='text-align: center; margin-top: 40px; color: #999;'>
                    <small>Created with IronPDF - Total Photos: " & imageFiles.Count & "</small>
                </div>
            </body>
            </html>"

        Dim pdf = renderer.RenderHtmlAsPdf(htmlContent)
        pdf.SaveAs(outputPath)
    End Sub
End Class

' Usage
PhotoAlbumCreator.CreatePhotoAlbum("C:\MyPhotos", "C:\MyPhotoAlbum.pdf")
$vbLabelText   $csharpLabel

This code example shows how IronPDF allows developers to implement embedding images with DataURIs, managing page breaks, and creating professional layouts. For cloud images, see Azure Blob Storage images guide. For large files, consider ImageToPDF file size optimization. Also scale PDF objects and translate PDF objects for precise positioning. The export PDFs to memory example helps with memory-efficient workflows. Refer to the adding HTML content efficiently guide for batch processing.

What Are the Licensing and Pricing Options?

IronPDF is a commercial C# PDF library available on the IronPDF website. Free for private development, licensed for commercial use. Various Licenses are available for single projects, developers, agencies, and corporations. Supports SaaS and OEM redistribution. Refer to the license keys guide for implementation details. When deploying, apply a license key properly. For web applications, set license keys in Web.config. For licensing server connection issues, consult troubleshooting guide. The using license keys guide provides complete implementation details.

Visual Studio IDE Tools menu showing NuGet Package Manager options including Package Manager Console and Manage NuGet Packages for Solution, providing centralized dependency management for .NET development projects

All licenses include 30-day money-back guarantee, one year support, and product updates. Perpetual licenses require one-time purchase without extra fees. Lite package for single developer/project starts from $799. For support beyond first year, see license extensions. To upgrade for additional features or deployment, check licensing upgrades. For IronPDF and IIS deployment or adding IronPDF to software installers, see specialized guides. The ClickOnce version incompatibility guide helps with deployment issues.

ExpertPDF offers per-developer or per-company licenses. Try ExpertPDF free. Check license features below. Consider using IronPDF's transparent licensing options in place of ExpertPDF for far greater value and complete support.

NuGet Package Manager interface displaying six ExpertPDF libraries with download statistics, showing HTML to PDF converter (145K downloads) and various specialized PDF manipulation tools, all at version 11.0.2.0

ExpertComponents Toolkit Total developer license starts from $850, ExpertPDF Toolkit from $750. Purchase single components separately. View Full Pricing for ExpertPDF. For enterprise requirements, IronPDF's licensing offers better value with complete feature sets.

Którą bibliotekę PDF wybrać?

IronPDF renders HTML to PDF locally without internet connection, simulating standards-compliant web browsers. The HTML render produces precise, vector-format output suitable for commercial printing. Licensed for commercial use with transparent pricing. For enterprise deployments, IronPDF offers Docker support and remote engine capabilities. Refer to the guides on running IronPDF as remote container and native vs remote engine options. The library provides IronPdf.Slim for reduced deployment size and supports package size optimization. The IronPdf.Slim v2025.5.6 deployment exception guide helps with specific version issues.

ExpertPDF's HTML-to-PDF Converter Library converts webpages and HTML to PDFs, generates reports from ASP.NET, and signs contracts electronically. Free to use with licensed additional features. Unlike IronPDF's complete platform support including Android deployment, ExpertPDF limits to Windows platforms. Behind the scenes, IronPDF use advanced security features and regular product updates. The milestones overview showcases continuous improvement including Chrome rendering milestone, compatibility milestone, and stability & performance milestone.

While both libraries handle PDFs and convert from popular formats, IronPDF offers advantages over ExpertPDF. IronPDF converts from wider format ranges including XML, images, AngularJS, Markdown, and RTF, with reliable PDF generation, formatting, and editing features. This ensures that developers achieve efficiency for pragmatic development. The library excels in performance improvement with async support for high-throughput scenarios. For concurrent processing, IronPDF supports parallel PDF generation and multi-threaded generation. Refer to the initial render slow troubleshooting guide for optimization details.

ExpertPDF requires separate component installation, whereas IronPDF integrates all functionality. This is particularly useful when projects require complete PDF features. IronPDF packages offer lifetime licenses without ongoing costs, while ExpertPDF requires renewals. Additionally, IronPDF provides complete documentation, API reference, and code examples for quick starts. The demos section showcases real implementations. W celu rozwiązania problemów zapoznaj się z krótkim przewodnikiem dotyczącym rozwiązywania problemów lub zapoznaj się z wydajnością wstępnego renderowania i optymalizacją procesów GPU. The getting the best support guide ensures efficient issue resolution.

For production deployments, IronPDF offers superior debugging capabilities, custom logging, and extensive troubleshooting guides. The library supports advanced features: PDF/A compliance, PDF/UA accessibility, digital signatures with HSM, and sanitization for secure handling. For enterprise security, IronPDF provides encryption and decryption, password protection, and complete security features. Advanced features include redacting text, flattening PDFs, and managing PDF versions. The convert PDF to base64 guide helps with data transmission.

Regarding support and development, IronPDF offers engineering support with detailed guides for making support requests. Library product updates and milestones demonstrate continuous improvement. For .NET MAUI developers, IronPDF provides PDF viewing capabilities and XAML to PDF conversion. Blazor developers use Blazor Server integration and Razor to PDF conversion. The library supports CSHTML to PDF conversion for MVC applications and headless CSHTML rendering. Refer to the Blazor Server / WebAssembly guide for limitations.

For specialized uses, IronPDF excels with OpenAI integration for intelligent processing, rendering charts in PDFs, converting CSHTML to PDF in MVC applications, and supporting international languages and UTF-8. The library handles complex scenarios: flattening PDFs, linearizing for fast web view, and creating PDF forms. Explore transforming PDF pages, removing PDF objects, and setting custom temp paths. IronPDF's complete feature overview showcases capabilities for creating PDFs, converting PDFs, editing PDFs, organizing PDFs, and securing PDFs. Additional features include read PDF files in C#, text find and replace, and remove specific PDF pages.

For deployment considerations, see debugging Azure Functions on local machine, Azure log files management, AWS log files handling, and solutions for 502 bad gateway errors. IronPDF provides complete error handling including access to path denied solutions, Chrome dependencies deployment, PDFium dependencies deployment, and bad allocation error solutions. Platform-specific support includes Linux-specific guides, macOS native exceptions, and Windows Nano Server limitations. Security features include Log4j vulnerability status and protection against segmentation faults on AWS Lambda.

Zwróć uwagęExpertPDF is a registered trademark of its respective owner. This site is not affiliated with, endorsed by, or sponsored by ExpertPDF. Wszystkie nazwy produktów, logo i marki są własnością ich odpowiednich właścicieli. Porównania mają charakter wyłącznie informacyjny i odzwierciedlają informacje dostępne publicznie w momencie pisania.

Często Zadawane Pytania

Jak mogę przekonwertować HTML na PDF w języku C#?

Możesz użyć metody RenderHtmlAsPdf biblioteki IronPDF do konwersji ciągów HTML na pliki PDF. Możesz również konwertować pliki HTML na pliki PDF za pomocą metody RenderHtmlFileAsPdf.

Jakie są główne różnice między IronPDF a ExpertPDF?

IronPDF oferuje szerszą obsługę formatów i zintegrowane funkcje, w tym tworzenie plików PDF z HTML, edycję i konwersję formatów. ExpertPDF zapewnia prostą konwersję HTML do PDF z opcjami konfiguracji plików wyjściowych i podpisów cyfrowych.

Czy za pomocą tych bibliotek mogę wyodrębnić tekst i obrazy z pliku PDF?

Tak, IronPDF umożliwia wyodrębnianie tekstu i obrazów z dokumentów PDF, ułatwiając manipulowanie i analizowanie treści PDF w aplikacjach .NET.

Jakie opcje instalacji są dostępne dla tych bibliotek PDF?

Zarówno IronPDF, jak i ExpertPDF można zainstalować za pomocą menedżera pakietów NuGet w Visual Studio. Dodatkowo bibliotekę .DLL IronPDF można pobrać bezpośrednio ze strony internetowej IronPDF.

Czy można połączyć wiele plików PDF w jeden dokument?

Tak, IronPDF udostępnia metodę Merge do łączenia wielu plików PDF w jeden dokument. ExpertPDF oferuje również komponent PDFMerge do scalania plików PDF.

Czy IronPDF wymaga połączenia z Internetem do konwersji HTML na PDF?

Nie, IronPDF nie wymaga połączenia z Internetem do konwersji HTML na PDF, co czyni go niezawodną opcją dla aplikacji działających w trybie offline.

Jakie opcje licencyjne są dostępne dla IronPDF?

IronPDF oferuje różne opcje licencyjne, w tym licencje na pojedynczy projekt, dla programistów, agencji i korporacji. Wszystkie licencje są bezterminowe i obejmują 30-dniową gwarancję zwrotu pieniędzy oraz roczną pomoc techniczną i aktualizacje.

Czy ExpertPDF obsługuje podpisy cyfrowe w dokumentach PDF?

Tak, ExpertPDF obsługuje podpisywanie cyfrowe dokumentów PDF, umożliwiając tworzenie bezpiecznych i uwierzytelnionych plików PDF.

Z jakimi wyzwaniami borykają się programiści C# podczas pracy z plikami PDF i w jaki sposób te biblioteki mogą im pomóc?

Programiści C# często napotykają trudności podczas odczytywania, pisania, tworzenia i konwertowania plików PDF. Biblioteki takie jak IronPDF i ExpertPDF upraszczają te zadania, zapewniając potężne narzędzia do konwersji HTML na PDF, edycji plików PDF i nie tylko, ułatwiając integrację z aplikacjami C#.

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