跳過到頁腳內容
產品比較

IronPDF與PDFSharpCore:2025年應選擇哪一個.NET PDF庫?

When developing modern .NET applications that require PDF generation and manipulation capabilities, choosing the right library can significantly impact your project's success. Two prominent options in the .NET ecosystem are IronPDF and PDFSharpCore, each offering distinct approaches to PDF handling. This comprehensive comparison will help you make an informed decision based on your specific requirements, budget, and technical needs.

快速比較概述

Before diving into the technical details, here's a comprehensive comparison table that summarizes the key differences betweenIronPDFand PDFSharpCore:

Product Comparison Overview
Comparison ofIronPDFand PDFSharpCore for .NET PDF Processing
Category Feature/Aspect IronPDF PDFSharpCore Key Advantage
Core Architecture Design Philosophy Chrome-based rendering, intuitive APIs Lightweight, manual PDF construction IronPDF: Faster development
API Complexity Simple methods like RenderHtmlAsPdf() Manual drawing with XGraphics IronPDF: 70% less code
Learning Curve 1-2 days typical 3-5 days typical IronPDF: Quicker adoption
Platform Support Cross-Platform Native support, no extra packages Full cross-platform support Both: Modern deployment
.NET Versions .NET 10, 9, 8, 7, 6, 5, Core 3.1+, Framework 4.6.2+ .NET 6+, .NET Standard 2.0 IronPDF: Broader compatibility
Operating Systems Windows, Linux, macOS, Docker, Azure, AWS Windows, Linux, macOS IronPDF: Cloud-optimized
HTML to PDF Rendering Engine Full Chrome V8 engine No native HTML support IronPDF: HTML capability
CSS3/HTML5 Support Complete support Requires third-party libraries IronPDF: Modern web standards
JavaScript Execution Full JavaScript support N/A IronPDF: Dynamic content
Core Features Text Extraction Built-in ExtractAllText() Limited support IronPDF: Superior extraction
Watermarking HTML/CSS based, full styling Manual drawing required IronPDF: Rich watermarks
Digital Signatures Integrated, visual signatures Not supported IronPDF: Enterprise security
Encryption AES-256, custom handlers Basic encryption support IronPDF: Advanced security
Headers/Footers HTML-based, dynamic content Manual positioning IronPDF: Dynamic headers
Performance HTML Rendering Speed 0.8-2s typical (Chrome engine) N/A IronPDF: HTML rendering
Large Document Processing Optimized for scale Memory efficient PDFSharpCore: Lower memory
Threading Support Native async/await, parallel processing Thread-safe operations IronPDF: Better scalability
Developer Experience Documentation Extensive tutorials, API docs, videos Basic documentation IronPDF: Better resources
Code Examples 100+ ready-to-run samples Community examples IronPDF: Extensive samples
IntelliSense Support Full IntelliSense, XML docs Standard IntelliSense Both: IDE integration
Licensing & Pricing License Type Commercial, perpetual MIT License (Free) PDFSharpCore: No cost
Entry Price Lite: $749 (1 dev, 1 project) Free PDFSharpCore: Zero cost
Support 24/5 engineering support included Community support only IronPDF: Professional support
Best For Use Cases Web apps, reports, enterprise Simple PDFs, budget projects Context-dependent
Note. PDFSharpCore is an open-source library suitable for basic PDF creation, whileIronPDFoffers comprehensive features including HTML rendering and enterprise support. The choice depends on project complexity and budget constraints.

Introduction toIronPDFand PDFSharpCore

What is IronPDF?

IronPDF is a comprehensive commercial .NET library designed to make PDF generation, editing, and manipulation effortless for developers. Built on a Chrome-based rendering engine, it excels at converting HTML, CSS, and JavaScript content into pixel-perfect PDFs. The library offers an extensive feature set that includes HTML to PDF conversion, digital signatures, watermarking, PDF encryption, and form management.

IronPDF supports modern .NET versions including .NET 10, 9, 8, 7, 6, 5, Core 3.1+, and Framework 4.6.2+, making it versatile for both new and legacy applications. Its cloud-optimized architecture ensures seamless deployment on Azure, AWS, and Docker environments.

What is PDFSharpCore?

PDFSharpCore is an open-source library that serves as a .NET Core port of the original PDFsharp library. Released under the MIT license, it focuses on programmatic PDF creation and basic manipulation without relying on Windows-specific libraries. This makes it an excellent choice for cross-platform projects running on Linux, macOS, and Windows.

While PDFSharpCore doesn't offer native HTML to PDF conversion, it provides precise control over PDF document creation through its drawing API. Developers can manually construct PDF documents by positioning text, images, and graphics using coordinate-based drawing commands.

Installation and Setup

安裝 IronPDF

To start usingIronPDFin your project, you can easily install it via NuGet Package Manager. Follow these steps:

  1. 在 Visual Studio 中打開項目。
  2. Navigate to Tools > NuGet Package Manager > Manage NuGet Packages for Solution.
  3. Search for IronPdf in the NuGet Manager.
  4. Select your project, then click on Install to addIronPDFto your project.

A Comparison BetweenIronPDF& PDFSharpCore: Figure 1 - InstallingIronPDFvia NuGet Package Manager InstallingIronPDFthrough Visual Studio's NuGet Package Manager interface

Alternatively, you can use the Package Manager Console to installIronPDFwith the following command:

Install-Package IronPdf

Installing PDFSharpCore

To install PDFSharpCore using NuGet, follow these instructions:

  1. Ensure your Visual Studio project is open.
  2. Go to Tools > NuGet Package Manager > Manage NuGet Packages for Solution.
  3. In the NuGet Package Manager, search for PDFSharpCore.
  4. Select your project and click Install to incorporate PDFSharpCore.

A Comparison BetweenIronPDF& PDFSharpCore: Figure 2 - Installing PDFSharpCore via NuGet PDFSharpCore installation through the NuGet Package Manager

For developers preferring the Package Manager Console, PDFSharpCore can be installed with this command:

Install-Package PdfSharpCore

Creating PDF Files:IronPDFvs PDFSharpCore

IronPDF: Modern HTML-Based Approach

IronPDF revolutionizes PDF creation by leveraging web technologies that developers already know. Its Chrome-based rendering engine ensures that your HTML, CSS, and JavaScript are rendered exactly as they would appear in a modern browser.

HTML String to PDF with Advanced Features

IronPDF's HTML to PDF conversion capabilities go far beyond simple text rendering. Here's an enhanced example that demonstrates its power:

using IronPdf;
using IronPdf.Rendering;

class Program
{
    static void Main(string[] args)
    {
        // Apply your license key (required for production)
        License.LicenseKey = "Your-License-Key";

        // Create renderer with optimized settings
        var renderer = new ChromePdfRenderer()
        {
            RenderingOptions = new ChromePdfRenderOptions()
            {
                // Set margins for professional appearance
                MarginTop = 25,
                MarginBottom = 25,
                MarginLeft = 20,
                MarginRight = 20,

                // Enable JavaScript execution for dynamic content
                EnableJavaScript = true,

                // Wait for AJAX/animations to complete
                RenderDelay = 500,

                // Set paper orientation and size
                PaperOrientation = PdfPaperOrientation.Portrait,
                PaperSize = PdfPaperSize.A4,

                // Enable printing of background colors and images
                PrintHtmlBackgrounds = true
            }
        };

        // HTML with Bootstrap styling and charts
        string htmlContent = @"
            <!DOCTYPE html>
            <html>
            <head>
                <link href='https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css' rel='stylesheet'>
                <script src='https://cdn.jsdelivr.net/npm/chart.js'></script>
                <style>
                    body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; }
                    .header { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; padding: 30px; }
                    .chart-container { width: 100%; height: 300px; margin: 20px 0; }
                </style>
            </head>
            <body>
                <div class='header text-center'>
                    <h1>2024 Sales Performance Report</h1>
                    <p class='lead'>Comprehensive Analysis & Insights</p>
                </div>

                <div class='container mt-4'>
                    <div class='row'>
                        <div class='col-md-6'>
                            <div class='card'>
                                <div class='card-body'>
                                    <h5 class='card-title'>Q1 Performance Metrics</h5>
                                    <table class='table table-striped'>
                                        <thead>
                                            <tr>
                                                <th>Month</th>
                                                <th>Revenue</th>
                                                <th>Growth</th>
                                            </tr>
                                        </thead>
                                        <tbody>
                                            <tr>
                                                <td>January</td>
                                                <td>$50,000</td>
                                                <td><span class='badge bg-success'>+12%</span></td>
                                            </tr>
                                            <tr>
                                                <td>February</td>
                                                <td>$55,000</td>
                                                <td><span class='badge bg-success'>+10%</span></td>
                                            </tr>
                                            <tr>
                                                <td>March</td>
                                                <td>$60,000</td>
                                                <td><span class='badge bg-success'>+9%</span></td>
                                            </tr>
                                        </tbody>
                                    </table>
                                </div>
                            </div>
                        </div>
                        <div class='col-md-6'>
                            <div class='card'>
                                <div class='card-body'>
                                    <h5 class='card-title'>Revenue Trend</h5>
                                    <canvas id='revenueChart'></canvas>
                                </div>
                            </div>
                        </div>
                    </div>

                    <div class='alert alert-info mt-4'>
                        <strong>Key Insight:</strong> Q1 showed consistent growth across all months, 
                        with total revenue reaching $165,000, representing a 31% increase YoY.
                    </div>
                </div>

                <script>
                    // Create an interactive chart
                    const ctx = document.getElementById('revenueChart').getContext('2d');
                    new Chart(ctx, {
                        type: 'line',
                        data: {
                            labels: ['January', 'February', 'March'],
                            datasets: [{
                                label: 'Revenue',
                                data: [50000, 55000, 60000],
                                borderColor: '#667eea',
                                backgroundColor: 'rgba(102, 126, 234, 0.1)',
                                tension: 0.4
                            }]
                        },
                        options: {
                            responsive: true,
                            maintainAspectRatio: false
                        }
                    });
                </script>
            </body>
            </html>";

        // Render the HTML to PDF
        var pdf = renderer.RenderHtmlAsPdf(htmlContent);

        // Add metadata for better document management
        pdf.MetaData.Author = "Sales Department";
        pdf.MetaData.Title = "Q1 2024 Sales Report";
        pdf.MetaData.Subject = "Quarterly Performance Analysis";
        pdf.MetaData.Keywords = "sales, performance, Q1, 2024";
        pdf.MetaData.CreationDate = DateTime.Now;

        // Save the PDF
        pdf.SaveAs("sales-report-q1-2024.pdf");
        Console.WriteLine("Professional sales report generated successfully!");
    }
}
using IronPdf;
using IronPdf.Rendering;

class Program
{
    static void Main(string[] args)
    {
        // Apply your license key (required for production)
        License.LicenseKey = "Your-License-Key";

        // Create renderer with optimized settings
        var renderer = new ChromePdfRenderer()
        {
            RenderingOptions = new ChromePdfRenderOptions()
            {
                // Set margins for professional appearance
                MarginTop = 25,
                MarginBottom = 25,
                MarginLeft = 20,
                MarginRight = 20,

                // Enable JavaScript execution for dynamic content
                EnableJavaScript = true,

                // Wait for AJAX/animations to complete
                RenderDelay = 500,

                // Set paper orientation and size
                PaperOrientation = PdfPaperOrientation.Portrait,
                PaperSize = PdfPaperSize.A4,

                // Enable printing of background colors and images
                PrintHtmlBackgrounds = true
            }
        };

        // HTML with Bootstrap styling and charts
        string htmlContent = @"
            <!DOCTYPE html>
            <html>
            <head>
                <link href='https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css' rel='stylesheet'>
                <script src='https://cdn.jsdelivr.net/npm/chart.js'></script>
                <style>
                    body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; }
                    .header { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; padding: 30px; }
                    .chart-container { width: 100%; height: 300px; margin: 20px 0; }
                </style>
            </head>
            <body>
                <div class='header text-center'>
                    <h1>2024 Sales Performance Report</h1>
                    <p class='lead'>Comprehensive Analysis & Insights</p>
                </div>

                <div class='container mt-4'>
                    <div class='row'>
                        <div class='col-md-6'>
                            <div class='card'>
                                <div class='card-body'>
                                    <h5 class='card-title'>Q1 Performance Metrics</h5>
                                    <table class='table table-striped'>
                                        <thead>
                                            <tr>
                                                <th>Month</th>
                                                <th>Revenue</th>
                                                <th>Growth</th>
                                            </tr>
                                        </thead>
                                        <tbody>
                                            <tr>
                                                <td>January</td>
                                                <td>$50,000</td>
                                                <td><span class='badge bg-success'>+12%</span></td>
                                            </tr>
                                            <tr>
                                                <td>February</td>
                                                <td>$55,000</td>
                                                <td><span class='badge bg-success'>+10%</span></td>
                                            </tr>
                                            <tr>
                                                <td>March</td>
                                                <td>$60,000</td>
                                                <td><span class='badge bg-success'>+9%</span></td>
                                            </tr>
                                        </tbody>
                                    </table>
                                </div>
                            </div>
                        </div>
                        <div class='col-md-6'>
                            <div class='card'>
                                <div class='card-body'>
                                    <h5 class='card-title'>Revenue Trend</h5>
                                    <canvas id='revenueChart'></canvas>
                                </div>
                            </div>
                        </div>
                    </div>

                    <div class='alert alert-info mt-4'>
                        <strong>Key Insight:</strong> Q1 showed consistent growth across all months, 
                        with total revenue reaching $165,000, representing a 31% increase YoY.
                    </div>
                </div>

                <script>
                    // Create an interactive chart
                    const ctx = document.getElementById('revenueChart').getContext('2d');
                    new Chart(ctx, {
                        type: 'line',
                        data: {
                            labels: ['January', 'February', 'March'],
                            datasets: [{
                                label: 'Revenue',
                                data: [50000, 55000, 60000],
                                borderColor: '#667eea',
                                backgroundColor: 'rgba(102, 126, 234, 0.1)',
                                tension: 0.4
                            }]
                        },
                        options: {
                            responsive: true,
                            maintainAspectRatio: false
                        }
                    });
                </script>
            </body>
            </html>";

        // Render the HTML to PDF
        var pdf = renderer.RenderHtmlAsPdf(htmlContent);

        // Add metadata for better document management
        pdf.MetaData.Author = "Sales Department";
        pdf.MetaData.Title = "Q1 2024 Sales Report";
        pdf.MetaData.Subject = "Quarterly Performance Analysis";
        pdf.MetaData.Keywords = "sales, performance, Q1, 2024";
        pdf.MetaData.CreationDate = DateTime.Now;

        // Save the PDF
        pdf.SaveAs("sales-report-q1-2024.pdf");
        Console.WriteLine("Professional sales report generated successfully!");
    }
}
Imports IronPdf
Imports IronPdf.Rendering

Friend Class Program
	Shared Sub Main(ByVal args() As String)
		' Apply your license key (required for production)
		License.LicenseKey = "Your-License-Key"

		' Create renderer with optimized settings
		Dim renderer = New ChromePdfRenderer() With {
			.RenderingOptions = New ChromePdfRenderOptions() With {
				.MarginTop = 25,
				.MarginBottom = 25,
				.MarginLeft = 20,
				.MarginRight = 20,
				.EnableJavaScript = True,
				.RenderDelay = 500,
				.PaperOrientation = PdfPaperOrientation.Portrait,
				.PaperSize = PdfPaperSize.A4,
				.PrintHtmlBackgrounds = True
			}
		}

		' HTML with Bootstrap styling and charts
		Dim htmlContent As String = "
            <!DOCTYPE html>
            <html>
            <head>
                <link href='https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css' rel='stylesheet'>
                <script src='https://cdn.jsdelivr.net/npm/chart.js'></script>
                <style>
                    body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; }
                    .header { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; padding: 30px; }
                    .chart-container { width: 100%; height: 300px; margin: 20px 0; }
                </style>
            </head>
            <body>
                <div class='header text-center'>
                    <h1>2024 Sales Performance Report</h1>
                    <p class='lead'>Comprehensive Analysis & Insights</p>
                </div>

                <div class='container mt-4'>
                    <div class='row'>
                        <div class='col-md-6'>
                            <div class='card'>
                                <div class='card-body'>
                                    <h5 class='card-title'>Q1 Performance Metrics</h5>
                                    <table class='table table-striped'>
                                        <thead>
                                            <tr>
                                                <th>Month</th>
                                                <th>Revenue</th>
                                                <th>Growth</th>
                                            </tr>
                                        </thead>
                                        <tbody>
                                            <tr>
                                                <td>January</td>
                                                <td>$50,000</td>
                                                <td><span class='badge bg-success'>+12%</span></td>
                                            </tr>
                                            <tr>
                                                <td>February</td>
                                                <td>$55,000</td>
                                                <td><span class='badge bg-success'>+10%</span></td>
                                            </tr>
                                            <tr>
                                                <td>March</td>
                                                <td>$60,000</td>
                                                <td><span class='badge bg-success'>+9%</span></td>
                                            </tr>
                                        </tbody>
                                    </table>
                                </div>
                            </div>
                        </div>
                        <div class='col-md-6'>
                            <div class='card'>
                                <div class='card-body'>
                                    <h5 class='card-title'>Revenue Trend</h5>
                                    <canvas id='revenueChart'></canvas>
                                </div>
                            </div>
                        </div>
                    </div>

                    <div class='alert alert-info mt-4'>
                        <strong>Key Insight:</strong> Q1 showed consistent growth across all months, 
                        with total revenue reaching $165,000, representing a 31% increase YoY.
                    </div>
                </div>

                <script>
                    // Create an interactive chart
                    const ctx = document.getElementById('revenueChart').getContext('2d');
                    new Chart(ctx, {
                        type: 'line',
                        data: {
                            labels: ['January', 'February', 'March'],
                            datasets: [{
                                label: 'Revenue',
                                data: [50000, 55000, 60000],
                                borderColor: '#667eea',
                                backgroundColor: 'rgba(102, 126, 234, 0.1)',
                                tension: 0.4
                            }]
                        },
                        options: {
                            responsive: true,
                            maintainAspectRatio: false
                        }
                    });
                </script>
            </body>
            </html>"

		' Render the HTML to PDF
		Dim pdf = renderer.RenderHtmlAsPdf(htmlContent)

		' Add metadata for better document management
		pdf.MetaData.Author = "Sales Department"
		pdf.MetaData.Title = "Q1 2024 Sales Report"
		pdf.MetaData.Subject = "Quarterly Performance Analysis"
		pdf.MetaData.Keywords = "sales, performance, Q1, 2024"
		pdf.MetaData.CreationDate = DateTime.Now

		' Save the PDF
		pdf.SaveAs("sales-report-q1-2024.pdf")
		Console.WriteLine("Professional sales report generated successfully!")
	End Sub
End Class
$vbLabelText   $csharpLabel

This example showcases several advanced features of IronPDF:

  • Bootstrap Integration: Leverages popular CSS frameworks for professional styling
  • JavaScript Charts: Renders dynamic Chart.js visualizations in the PDF
  • Responsive Design: Handles responsive layouts intelligently
  • Metadata Management: Adds searchable metadata for document management systems
  • Render Delays: Ensures JavaScript content loads completely before rendering

The ChromePdfRenderer class provides extensive control over the rendering process. Key options include:

  • EnableJavaScript: Executes JavaScript code before rendering
  • RenderDelay: Waits for asynchronous content to load
  • PrintHtmlBackgrounds: Preserves background colors and images
  • PaperOrientation and PaperSize: Controls page layout
  • Margin settings for professional document appearance

Converting HTML Files and URLs

IronPDF also excels at converting existing HTML files and live web pages:

using IronPdf;

class Program
{
    static async Task Main(string[] args)
    {
        License.LicenseKey = "Your-License-Key";

        var renderer = new ChromePdfRenderer();

        // Convert a local HTML file with external resources
        var filePdf = renderer.RenderHtmlFileAsPdf(@"C:\Reports\template.html");
        filePdf.SaveAs("from-file.pdf");

        // Convert a URL with authentication
        renderer.LoginCredentials = new ChromeHttpLoginCredentials()
        {
            Username = "user@example.com",
            Password = "secure-password"
        };

        // Render a password-protected page
        var urlPdf = await renderer.RenderUrlAsPdfAsync("https://secure.example.com/reports");
        urlPdf.SaveAs("secure-report.pdf");
    }
}
using IronPdf;

class Program
{
    static async Task Main(string[] args)
    {
        License.LicenseKey = "Your-License-Key";

        var renderer = new ChromePdfRenderer();

        // Convert a local HTML file with external resources
        var filePdf = renderer.RenderHtmlFileAsPdf(@"C:\Reports\template.html");
        filePdf.SaveAs("from-file.pdf");

        // Convert a URL with authentication
        renderer.LoginCredentials = new ChromeHttpLoginCredentials()
        {
            Username = "user@example.com",
            Password = "secure-password"
        };

        // Render a password-protected page
        var urlPdf = await renderer.RenderUrlAsPdfAsync("https://secure.example.com/reports");
        urlPdf.SaveAs("secure-report.pdf");
    }
}
Imports IronPdf

Friend Class Program
	Shared Async Function Main(ByVal args() As String) As Task
		License.LicenseKey = "Your-License-Key"

		Dim renderer = New ChromePdfRenderer()

		' Convert a local HTML file with external resources
		Dim filePdf = renderer.RenderHtmlFileAsPdf("C:\Reports\template.html")
		filePdf.SaveAs("from-file.pdf")

		' Convert a URL with authentication
		renderer.LoginCredentials = New ChromeHttpLoginCredentials() With {
			.Username = "user@example.com",
			.Password = "secure-password"
		}

		' Render a password-protected page
		Dim urlPdf = Await renderer.RenderUrlAsPdfAsync("https://secure.example.com/reports")
		urlPdf.SaveAs("secure-report.pdf")
	End Function
End Class
$vbLabelText   $csharpLabel

PDFSharpCore: Manual Document Construction

PDFSharpCore takes a fundamentally different approach, requiring developers to manually construct PDF documents using drawing commands. While this provides precise control, it requires significantly more code for complex layouts.

using PdfSharpCore.Drawing;
using PdfSharpCore.Pdf;
using System;

class Program
{
    static void Main()
    {
        // Create a new PDF document
        var document = new PdfDocument();
        document.Info.Title = "Sales Report Q1 2024";
        document.Info.Author = "Sales Department";

        // Add a page
        var page = document.AddPage();
        page.Size = PdfSharpCore.PageSize.A4;

        // Create graphics object for drawing
        var gfx = XGraphics.FromPdfPage(page);

        // Define fonts
        var titleFont = new XFont("Arial", 24, XFontStyle.Bold);
        var headingFont = new XFont("Arial", 14, XFontStyle.Bold);
        var normalFont = new XFont("Arial", 11, XFontStyle.Regular);

        // Draw title with gradient-like effect (manual implementation)
        var titleBrush = new XLinearGradientBrush(
            new XPoint(0, 0), 
            new XPoint(page.Width, 0),
            XColors.DarkBlue, 
            XColors.Purple
        );
        gfx.DrawRectangle(titleBrush, 0, 0, page.Width, 80);
        gfx.DrawString("2024 Sales Performance Report", 
            titleFont, XBrushes.White,
            new XRect(0, 20, page.Width, 40),
            XStringFormats.TopCenter);

        // Draw table manually
        double yPosition = 120;
        double margin = 50;
        double columnWidth = (page.Width - 2 * margin) / 3;

        // Table header
        gfx.DrawRectangle(XBrushes.LightGray, margin, yPosition, page.Width - 2 * margin, 25);
        gfx.DrawString("Month", headingFont, XBrushes.Black, 
            new XRect(margin, yPosition, columnWidth, 25), 
            XStringFormats.Center);
        gfx.DrawString("Revenue", headingFont, XBrushes.Black, 
            new XRect(margin + columnWidth, yPosition, columnWidth, 25), 
            XStringFormats.Center);
        gfx.DrawString("Growth", headingFont, XBrushes.Black, 
            new XRect(margin + 2 * columnWidth, yPosition, columnWidth, 25), 
            XStringFormats.Center);

        // Table data
        string[,] data = {
            { "January", "$50,000", "+12%" },
            { "February", "$55,000", "+10%" },
            { "March", "$60,000", "+9%" }
        };

        yPosition += 25;
        for (int i = 0; i < 3; i++)
        {
            // Alternate row colors
            if (i % 2 == 0)
            {
                gfx.DrawRectangle(XBrushes.WhiteSmoke, margin, yPosition, page.Width - 2 * margin, 20);
            }

            for (int j = 0; j < 3; j++)
            {
                gfx.DrawString(data[i, j], normalFont, XBrushes.Black,
                    new XRect(margin + j * columnWidth, yPosition, columnWidth, 20),
                    XStringFormats.Center);
            }
            yPosition += 20;
        }

        // Draw a simple line chart (very basic implementation)
        yPosition += 40;
        gfx.DrawString("Revenue Trend", headingFont, XBrushes.Black,
            new XRect(margin, yPosition, page.Width - 2 * margin, 25),
            XStringFormats.TopLeft);

        // Chart area
        yPosition += 30;
        double chartHeight = 150;
        double chartWidth = page.Width - 2 * margin;

        // Draw axes
        gfx.DrawLine(XPens.Black, margin, yPosition + chartHeight, margin + chartWidth, yPosition + chartHeight);
        gfx.DrawLine(XPens.Black, margin, yPosition, margin, yPosition + chartHeight);

        // Plot points (simplified)
        double[] revenues = { 50000, 55000, 60000 };
        double maxRevenue = 65000;
        double xStep = chartWidth / 3;

        for (int i = 0; i < revenues.Length; i++)
        {
            double x = margin + (i + 0.5) * xStep;
            double y = yPosition + chartHeight - (revenues[i] / maxRevenue * chartHeight);

            // Draw point
            gfx.DrawEllipse(XBrushes.Blue, x - 3, y - 3, 6, 6);

            // Draw connecting lines
            if (i > 0)
            {
                double prevX = margin + (i - 0.5) * xStep;
                double prevY = yPosition + chartHeight - (revenues[i - 1] / maxRevenue * chartHeight);
                gfx.DrawLine(new XPen(XColors.Blue, 2), prevX, prevY, x, y);
            }

            // Labels
            gfx.DrawString($"${revenues[i]:N0}", normalFont, XBrushes.Black,
                new XRect(x - 30, y - 20, 60, 15),
                XStringFormats.TopCenter);
        }

        // Save the document
        document.Save("pdfsharp-sales-report.pdf");
        Console.WriteLine("PDF created with PDFSharpCore");
    }
}
using PdfSharpCore.Drawing;
using PdfSharpCore.Pdf;
using System;

class Program
{
    static void Main()
    {
        // Create a new PDF document
        var document = new PdfDocument();
        document.Info.Title = "Sales Report Q1 2024";
        document.Info.Author = "Sales Department";

        // Add a page
        var page = document.AddPage();
        page.Size = PdfSharpCore.PageSize.A4;

        // Create graphics object for drawing
        var gfx = XGraphics.FromPdfPage(page);

        // Define fonts
        var titleFont = new XFont("Arial", 24, XFontStyle.Bold);
        var headingFont = new XFont("Arial", 14, XFontStyle.Bold);
        var normalFont = new XFont("Arial", 11, XFontStyle.Regular);

        // Draw title with gradient-like effect (manual implementation)
        var titleBrush = new XLinearGradientBrush(
            new XPoint(0, 0), 
            new XPoint(page.Width, 0),
            XColors.DarkBlue, 
            XColors.Purple
        );
        gfx.DrawRectangle(titleBrush, 0, 0, page.Width, 80);
        gfx.DrawString("2024 Sales Performance Report", 
            titleFont, XBrushes.White,
            new XRect(0, 20, page.Width, 40),
            XStringFormats.TopCenter);

        // Draw table manually
        double yPosition = 120;
        double margin = 50;
        double columnWidth = (page.Width - 2 * margin) / 3;

        // Table header
        gfx.DrawRectangle(XBrushes.LightGray, margin, yPosition, page.Width - 2 * margin, 25);
        gfx.DrawString("Month", headingFont, XBrushes.Black, 
            new XRect(margin, yPosition, columnWidth, 25), 
            XStringFormats.Center);
        gfx.DrawString("Revenue", headingFont, XBrushes.Black, 
            new XRect(margin + columnWidth, yPosition, columnWidth, 25), 
            XStringFormats.Center);
        gfx.DrawString("Growth", headingFont, XBrushes.Black, 
            new XRect(margin + 2 * columnWidth, yPosition, columnWidth, 25), 
            XStringFormats.Center);

        // Table data
        string[,] data = {
            { "January", "$50,000", "+12%" },
            { "February", "$55,000", "+10%" },
            { "March", "$60,000", "+9%" }
        };

        yPosition += 25;
        for (int i = 0; i < 3; i++)
        {
            // Alternate row colors
            if (i % 2 == 0)
            {
                gfx.DrawRectangle(XBrushes.WhiteSmoke, margin, yPosition, page.Width - 2 * margin, 20);
            }

            for (int j = 0; j < 3; j++)
            {
                gfx.DrawString(data[i, j], normalFont, XBrushes.Black,
                    new XRect(margin + j * columnWidth, yPosition, columnWidth, 20),
                    XStringFormats.Center);
            }
            yPosition += 20;
        }

        // Draw a simple line chart (very basic implementation)
        yPosition += 40;
        gfx.DrawString("Revenue Trend", headingFont, XBrushes.Black,
            new XRect(margin, yPosition, page.Width - 2 * margin, 25),
            XStringFormats.TopLeft);

        // Chart area
        yPosition += 30;
        double chartHeight = 150;
        double chartWidth = page.Width - 2 * margin;

        // Draw axes
        gfx.DrawLine(XPens.Black, margin, yPosition + chartHeight, margin + chartWidth, yPosition + chartHeight);
        gfx.DrawLine(XPens.Black, margin, yPosition, margin, yPosition + chartHeight);

        // Plot points (simplified)
        double[] revenues = { 50000, 55000, 60000 };
        double maxRevenue = 65000;
        double xStep = chartWidth / 3;

        for (int i = 0; i < revenues.Length; i++)
        {
            double x = margin + (i + 0.5) * xStep;
            double y = yPosition + chartHeight - (revenues[i] / maxRevenue * chartHeight);

            // Draw point
            gfx.DrawEllipse(XBrushes.Blue, x - 3, y - 3, 6, 6);

            // Draw connecting lines
            if (i > 0)
            {
                double prevX = margin + (i - 0.5) * xStep;
                double prevY = yPosition + chartHeight - (revenues[i - 1] / maxRevenue * chartHeight);
                gfx.DrawLine(new XPen(XColors.Blue, 2), prevX, prevY, x, y);
            }

            // Labels
            gfx.DrawString($"${revenues[i]:N0}", normalFont, XBrushes.Black,
                new XRect(x - 30, y - 20, 60, 15),
                XStringFormats.TopCenter);
        }

        // Save the document
        document.Save("pdfsharp-sales-report.pdf");
        Console.WriteLine("PDF created with PDFSharpCore");
    }
}
Imports PdfSharpCore.Drawing
Imports PdfSharpCore.Pdf
Imports System

Friend Class Program
	Shared Sub Main()
		' Create a new PDF document
		Dim document = New PdfDocument()
		document.Info.Title = "Sales Report Q1 2024"
		document.Info.Author = "Sales Department"

		' Add a page
		Dim page = document.AddPage()
		page.Size = PdfSharpCore.PageSize.A4

		' Create graphics object for drawing
		Dim gfx = XGraphics.FromPdfPage(page)

		' Define fonts
		Dim titleFont = New XFont("Arial", 24, XFontStyle.Bold)
		Dim headingFont = New XFont("Arial", 14, XFontStyle.Bold)
		Dim normalFont = New XFont("Arial", 11, XFontStyle.Regular)

		' Draw title with gradient-like effect (manual implementation)
		Dim titleBrush = New XLinearGradientBrush(New XPoint(0, 0), New XPoint(page.Width, 0), XColors.DarkBlue, XColors.Purple)
		gfx.DrawRectangle(titleBrush, 0, 0, page.Width, 80)
		gfx.DrawString("2024 Sales Performance Report", titleFont, XBrushes.White, New XRect(0, 20, page.Width, 40), XStringFormats.TopCenter)

		' Draw table manually
		Dim yPosition As Double = 120
		Dim margin As Double = 50
		Dim columnWidth As Double = (page.Width - 2 * margin) / 3

		' Table header
		gfx.DrawRectangle(XBrushes.LightGray, margin, yPosition, page.Width - 2 * margin, 25)
		gfx.DrawString("Month", headingFont, XBrushes.Black, New XRect(margin, yPosition, columnWidth, 25), XStringFormats.Center)
		gfx.DrawString("Revenue", headingFont, XBrushes.Black, New XRect(margin + columnWidth, yPosition, columnWidth, 25), XStringFormats.Center)
		gfx.DrawString("Growth", headingFont, XBrushes.Black, New XRect(margin + 2 * columnWidth, yPosition, columnWidth, 25), XStringFormats.Center)

		' Table data
		Dim data(,) As String = {
			{ "January", "$50,000", "+12%" },
			{ "February", "$55,000", "+10%" },
			{ "March", "$60,000", "+9%" }
		}

		yPosition += 25
		For i As Integer = 0 To 2
			' Alternate row colors
			If i Mod 2 = 0 Then
				gfx.DrawRectangle(XBrushes.WhiteSmoke, margin, yPosition, page.Width - 2 * margin, 20)
			End If

			For j As Integer = 0 To 2
				gfx.DrawString(data(i, j), normalFont, XBrushes.Black, New XRect(margin + j * columnWidth, yPosition, columnWidth, 20), XStringFormats.Center)
			Next j
			yPosition += 20
		Next i

		' Draw a simple line chart (very basic implementation)
		yPosition += 40
		gfx.DrawString("Revenue Trend", headingFont, XBrushes.Black, New XRect(margin, yPosition, page.Width - 2 * margin, 25), XStringFormats.TopLeft)

		' Chart area
		yPosition += 30
		Dim chartHeight As Double = 150
		Dim chartWidth As Double = page.Width - 2 * margin

		' Draw axes
		gfx.DrawLine(XPens.Black, margin, yPosition + chartHeight, margin + chartWidth, yPosition + chartHeight)
		gfx.DrawLine(XPens.Black, margin, yPosition, margin, yPosition + chartHeight)

		' Plot points (simplified)
		Dim revenues() As Double = { 50000, 55000, 60000 }
		Dim maxRevenue As Double = 65000
		Dim xStep As Double = chartWidth / 3

		For i As Integer = 0 To revenues.Length - 1
			Dim x As Double = margin + (i + 0.5) * xStep
			Dim y As Double = yPosition + chartHeight - (revenues(i) / maxRevenue * chartHeight)

			' Draw point
			gfx.DrawEllipse(XBrushes.Blue, x - 3, y - 3, 6, 6)

			' Draw connecting lines
			If i > 0 Then
				Dim prevX As Double = margin + (i - 0.5) * xStep
				Dim prevY As Double = yPosition + chartHeight - (revenues(i - 1) / maxRevenue * chartHeight)
				gfx.DrawLine(New XPen(XColors.Blue, 2), prevX, prevY, x, y)
			End If

			' Labels
			gfx.DrawString($"${revenues(i):N0}", normalFont, XBrushes.Black, New XRect(x - 30, y - 20, 60, 15), XStringFormats.TopCenter)
		Next i

		' Save the document
		document.Save("pdfsharp-sales-report.pdf")
		Console.WriteLine("PDF created with PDFSharpCore")
	End Sub
End Class
$vbLabelText   $csharpLabel

As you can see, creating even a moderately complex document with PDFSharpCore requires:

  • Manual positioning of every element
  • Complex calculations for layouts
  • No built-in support for HTML or CSS
  • Manual implementation of charts and graphics
  • Significantly more code for the same result

HTML to PDF with PDFSharpCore

Since PDFSharpCore doesn't natively support HTML to PDF conversion, developers must use third-party libraries. A popular choice is combining PDFSharpCore with HtmlRenderer:

using PdfSharpCore.Pdf;
using TheArtOfDev.HtmlRenderer.PdfSharp;

var document = new PdfDocument();
string htmlContent = File.ReadAllText("template.html");

// Note: HtmlRenderer has limited CSS support
PdfGenerator.AddPdfPages(document, htmlContent, PdfSharpCore.PageSize.A4);
document.Save("from-html.pdf");
using PdfSharpCore.Pdf;
using TheArtOfDev.HtmlRenderer.PdfSharp;

var document = new PdfDocument();
string htmlContent = File.ReadAllText("template.html");

// Note: HtmlRenderer has limited CSS support
PdfGenerator.AddPdfPages(document, htmlContent, PdfSharpCore.PageSize.A4);
document.Save("from-html.pdf");
Imports PdfSharpCore.Pdf
Imports TheArtOfDev.HtmlRenderer.PdfSharp

Private document = New PdfDocument()
Private htmlContent As String = File.ReadAllText("template.html")

' Note: HtmlRenderer has limited CSS support
PdfGenerator.AddPdfPages(document, htmlContent, PdfSharpCore.PageSize.A4)
document.Save("from-html.pdf")
$vbLabelText   $csharpLabel

However, this approach has significant limitations:

  • Limited CSS3 support (approximately 70-80% compatibility)
  • No JavaScript execution
  • Poor handling of modern web features
  • Inconsistent rendering compared to browsers

Modern CSS Framework Support: Bootstrap and Beyond

When developing applications that require PDF generation from web content, Bootstrap and modern CSS framework support is critical. Most web applications use these frameworks for consistent design, and the ability to convert these interfaces to PDF without modification significantly reduces development time.

IronPDF: 完整的 Bootstrap 與 CSS 框架支持

  • Bootstrap 5:完整的Flexbox佈局引擎、CSS Grid、實用類和所有組件系統
  • Bootstrap 4: Full card components, navigation, flex utilities, and responsive classes
  • Tailwind CSS: All utility classes with accurate rendering
  • Foundation: 完整的網格系統和組件庫
  • 現代 CSS3: Flexbox、CSS 網格、自定義屬性、動畫、過渡和變換

Real-world proof:IronPDFrenders the Bootstrap homepage and all official templates with pixel-perfect accuracy.

Code Example: Project Progress Dashboard

using IronPdf;

// Set yourIronPDFlicense key
IronPdf.License.LicenseKey = "License-Key goes here";

var renderer = new ChromePdfRenderer();
string bootstrapProgress = @"
<!DOCTYPE html>
<html>
<head>
    <link href='https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css' rel='stylesheet'>
    <style>
        .project-card {
            transition: all 0.3s ease;
            border-left: 4px solid transparent;
        }
        .project-card.active { border-left-color: #0d6efd; }
        .progress-label { font-size: 0.75rem; font-weight: 600; }
    </style>
</head>
<body>
    <div class='container my-5'>
        <div class='d-flex justify-content-between align-items-center mb-4'>
            <div>
                <h1 class='display-6 mb-1'>Project Portfolio Status</h1>
                <p class='text-muted mb-0'>Q1 2025 Development Pipeline</p>
            </div>
            <div>
                <span class='badge bg-success fs-6'>8 Active Projects</span>
            </div>
        </div>

        <div class='row g-4 mb-4'>
            <div class='col-md-3'>
                <div class='card text-center shadow-sm'>
                    <div class='card-body'>
                        <div class='display-4 text-primary mb-2'>72%</div>
                        <h6 class='text-muted text-uppercase mb-0'>Overall Progress</h6>
                    </div>
                </div>
            </div>
            <div class='col-md-3'>
                <div class='card text-center shadow-sm'>
                    <div class='card-body'>
                        <div class='display-4 text-success mb-2'>5</div>
                        <h6 class='text-muted text-uppercase mb-0'>On Track</h6>
                    </div>
                </div>
            </div>
            <div class='col-md-3'>
                <div class='card text-center shadow-sm'>
                    <div class='card-body'>
                        <div class='display-4 text-warning mb-2'>2</div>
                        <h6 class='text-muted text-uppercase mb-0'>At Risk</h6>
                    </div>
                </div>
            </div>
            <div class='col-md-3'>
                <div class='card text-center shadow-sm'>
                    <div class='card-body'>
                        <div class='display-4 text-danger mb-2'>1</div>
                        <h6 class='text-muted text-uppercase mb-0'>Delayed</h6>
                    </div>
                </div>
            </div>
        </div>

        <div class='card shadow-sm mb-4'>
            <div class='card-header bg-primary text-white'>
                <h5 class='mb-0'>Active Projects</h5>
            </div>
            <div class='card-body p-0'>
                <div class='list-group list-group-flush'>
                    <div class='list-group-item'>
                        <div class='d-flex justify-content-between align-items-start mb-3'>
                            <div>
                                <h6 class='mb-1'>E-Commerce Platform Redesign</h6>
                                <small class='text-muted'>Lead: Sarah Chen | Due: Apr 15, 2025</small>
                            </div>
                            <span class='badge bg-success'>On Track</span>
                        </div>
                        <div class='mb-2'>
                            <div class='d-flex justify-content-between align-items-center mb-1'>
                                <span class='progress-label text-muted'>COMPLETION</span>
                                <span class='progress-label text-primary'>85%</span>
                            </div>
                            <div class='progress' style='height: 8px;'>
                                <div class='progress-bar bg-primary' role='progressbar' style='width: 85%'></div>
                            </div>
                        </div>
                        <div class='d-flex gap-2 flex-wrap'>
                            <span class='badge bg-light text-dark'>Frontend: 90%</span>
                            <span class='badge bg-light text-dark'>Backend: 80%</span>
                            <span class='badge bg-light text-dark'>Testing: 85%</span>
                        </div>
                    </div>

                    <div class='list-group-item'>
                        <div class='d-flex justify-content-between align-items-start mb-3'>
                            <div>
                                <h6 class='mb-1'>Mobile App Integration</h6>
                                <small class='text-muted'>Lead: Marcus Johnson | Due: Mar 30, 2025</small>
                            </div>
                            <span class='badge bg-success'>On Track</span>
                        </div>
                        <div class='mb-2'>
                            <div class='d-flex justify-content-between align-items-center mb-1'>
                                <span class='progress-label text-muted'>COMPLETION</span>
                                <span class='progress-label text-success'>92%</span>
                            </div>
                            <div class='progress' style='height: 8px;'>
                                <div class='progress-bar bg-success' role='progressbar' style='width: 92%'></div>
                            </div>
                        </div>
                        <div class='d-flex gap-2 flex-wrap'>
                            <span class='badge bg-light text-dark'>iOS: 95%</span>
                            <span class='badge bg-light text-dark'>Android: 90%</span>
                            <span class='badge bg-light text-dark'>API: 100%</span>
                        </div>
                    </div>

                    <div class='list-group-item'>
                        <div class='d-flex justify-content-between align-items-start mb-3'>
                            <div>
                                <h6 class='mb-1'>Customer Analytics Dashboard</h6>
                                <small class='text-muted'>Lead: Emily Rodriguez | Due: Apr 22, 2025</small>
                            </div>
                            <span class='badge bg-warning text-dark'>At Risk</span>
                        </div>
                        <div class='mb-2'>
                            <div class='d-flex justify-content-between align-items-center mb-1'>
                                <span class='progress-label text-muted'>COMPLETION</span>
                                <span class='progress-label text-warning'>58%</span>
                            </div>
                            <div class='progress' style='height: 8px;'>
                                <div class='progress-bar bg-warning' role='progressbar' style='width: 58%'></div>
                            </div>
                        </div>
                        <div class='d-flex gap-2 flex-wrap'>
                            <span class='badge bg-light text-dark'>Data Pipeline: 65%</span>
                            <span class='badge bg-light text-dark'>UI: 50%</span>
                            <span class='badge bg-light text-dark'>Reports: 45%</span>
                        </div>
                        <div class='alert alert-warning mt-2 mb-0 py-2'>
                            <small><strong>Issue:</strong> Resource constraints affecting timeline. Review scheduled for next week.</small>
                        </div>
                    </div>

                    <div class='list-group-item'>
                        <div class='d-flex justify-content-between align-items-start mb-3'>
                            <div>
                                <h6 class='mb-1'>Security Infrastructure Upgrade</h6>
                                <small class='text-muted'>Lead: David Kim | Due: Mar 25, 2025</small>
                            </div>
                            <span class='badge bg-danger'>Delayed</span>
                        </div>
                        <div class='mb-2'>
                            <div class='d-flex justify-content-between align-items-center mb-1'>
                                <span class='progress-label text-muted'>COMPLETION</span>
                                <span class='progress-label text-danger'>42%</span>
                            </div>
                            <div class='progress' style='height: 8px;'>
                                <div class='progress-bar bg-danger' role='progressbar' style='width: 42%'></div>
                            </div>
                        </div>
                        <div class='d-flex gap-2 flex-wrap'>
                            <span class='badge bg-light text-dark'>Authentication: 60%</span>
                            <span class='badge bg-light text-dark'>Encryption: 40%</span>
                            <span class='badge bg-light text-dark'>Audit Logs: 25%</span>
                        </div>
                        <div class='alert alert-danger mt-2 mb-0 py-2'>
                            <small><strong>Critical:</strong> 7 days behind schedule. Additional resources allocated. Daily standup required.</small>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <div class='row g-4'>
            <div class='col-md-6'>
                <div class='card shadow-sm'>
                    <div class='card-header bg-white'>
                        <h5 class='mb-0'>Sprint Velocity</h5>
                    </div>
                    <div class='card-body'>
                        <div class='mb-3'>
                            <div class='d-flex justify-content-between mb-1'>
                                <span class='text-muted'>Current Sprint</span>
                                <strong>42 Story Points</strong>
                            </div>
                            <div class='progress' style='height: 20px;'>
                                <div class='progress-bar bg-success' style='width: 84%'>84% Complete</div>
                            </div>
                        </div>
                        <div class='mb-3'>
                            <div class='d-flex justify-content-between mb-1'>
                                <span class='text-muted'>Previous Sprint</span>
                                <strong>38 Story Points</strong>
                            </div>
                            <div class='progress' style='height: 20px;'>
                                <div class='progress-bar bg-info' style='width: 100%'>Completed</div>
                            </div>
                        </div>
                        <div class='mb-0'>
                            <div class='d-flex justify-content-between mb-1'>
                                <span class='text-muted'>Average Velocity</span>
                                <strong>40 Story Points</strong>
                            </div>
                            <div class='progress' style='height: 20px;'>
                                <div class='progress-bar bg-primary' style='width: 100%'>Baseline</div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <div class='col-md-6'>
                <div class='card shadow-sm'>
                    <div class='card-header bg-white'>
                        <h5 class='mb-0'>Team Capacity</h5>
                    </div>
                    <div class='card-body'>
                        <div class='d-flex justify-content-between align-items-center mb-3'>
                            <div>
                                <h6 class='mb-0'>Frontend Team</h6>
                                <small class='text-muted'>6 developers</small>
                            </div>
                            <span class='badge bg-success'>92% Utilized</span>
                        </div>
                        <div class='d-flex justify-content-between align-items-center mb-3'>
                            <div>
                                <h6 class='mb-0'>Backend Team</h6>
                                <small class='text-muted'>5 developers</small>
                            </div>
                            <span class='badge bg-success'>88% Utilized</span>
                        </div>
                        <div class='d-flex justify-content-between align-items-center mb-3'>
                            <div>
                                <h6 class='mb-0'>QA Team</h6>
                                <small class='text-muted'>3 testers</small>
                            </div>
                            <span class='badge bg-warning text-dark'>105% Utilized</span>
                        </div>
                        <div class='d-flex justify-content-between align-items-center mb-0'>
                            <div>
                                <h6 class='mb-0'>DevOps Team</h6>
                                <small class='text-muted'>2 engineers</small>
                            </div>
                            <span class='badge bg-danger'>110% Utilized</span>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</body>
</html>";

var pdf = renderer.RenderHtmlAsPdf(bootstrapProgress);
pdf.SaveAs("project-progress.pdf");
using IronPdf;

// Set yourIronPDFlicense key
IronPdf.License.LicenseKey = "License-Key goes here";

var renderer = new ChromePdfRenderer();
string bootstrapProgress = @"
<!DOCTYPE html>
<html>
<head>
    <link href='https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css' rel='stylesheet'>
    <style>
        .project-card {
            transition: all 0.3s ease;
            border-left: 4px solid transparent;
        }
        .project-card.active { border-left-color: #0d6efd; }
        .progress-label { font-size: 0.75rem; font-weight: 600; }
    </style>
</head>
<body>
    <div class='container my-5'>
        <div class='d-flex justify-content-between align-items-center mb-4'>
            <div>
                <h1 class='display-6 mb-1'>Project Portfolio Status</h1>
                <p class='text-muted mb-0'>Q1 2025 Development Pipeline</p>
            </div>
            <div>
                <span class='badge bg-success fs-6'>8 Active Projects</span>
            </div>
        </div>

        <div class='row g-4 mb-4'>
            <div class='col-md-3'>
                <div class='card text-center shadow-sm'>
                    <div class='card-body'>
                        <div class='display-4 text-primary mb-2'>72%</div>
                        <h6 class='text-muted text-uppercase mb-0'>Overall Progress</h6>
                    </div>
                </div>
            </div>
            <div class='col-md-3'>
                <div class='card text-center shadow-sm'>
                    <div class='card-body'>
                        <div class='display-4 text-success mb-2'>5</div>
                        <h6 class='text-muted text-uppercase mb-0'>On Track</h6>
                    </div>
                </div>
            </div>
            <div class='col-md-3'>
                <div class='card text-center shadow-sm'>
                    <div class='card-body'>
                        <div class='display-4 text-warning mb-2'>2</div>
                        <h6 class='text-muted text-uppercase mb-0'>At Risk</h6>
                    </div>
                </div>
            </div>
            <div class='col-md-3'>
                <div class='card text-center shadow-sm'>
                    <div class='card-body'>
                        <div class='display-4 text-danger mb-2'>1</div>
                        <h6 class='text-muted text-uppercase mb-0'>Delayed</h6>
                    </div>
                </div>
            </div>
        </div>

        <div class='card shadow-sm mb-4'>
            <div class='card-header bg-primary text-white'>
                <h5 class='mb-0'>Active Projects</h5>
            </div>
            <div class='card-body p-0'>
                <div class='list-group list-group-flush'>
                    <div class='list-group-item'>
                        <div class='d-flex justify-content-between align-items-start mb-3'>
                            <div>
                                <h6 class='mb-1'>E-Commerce Platform Redesign</h6>
                                <small class='text-muted'>Lead: Sarah Chen | Due: Apr 15, 2025</small>
                            </div>
                            <span class='badge bg-success'>On Track</span>
                        </div>
                        <div class='mb-2'>
                            <div class='d-flex justify-content-between align-items-center mb-1'>
                                <span class='progress-label text-muted'>COMPLETION</span>
                                <span class='progress-label text-primary'>85%</span>
                            </div>
                            <div class='progress' style='height: 8px;'>
                                <div class='progress-bar bg-primary' role='progressbar' style='width: 85%'></div>
                            </div>
                        </div>
                        <div class='d-flex gap-2 flex-wrap'>
                            <span class='badge bg-light text-dark'>Frontend: 90%</span>
                            <span class='badge bg-light text-dark'>Backend: 80%</span>
                            <span class='badge bg-light text-dark'>Testing: 85%</span>
                        </div>
                    </div>

                    <div class='list-group-item'>
                        <div class='d-flex justify-content-between align-items-start mb-3'>
                            <div>
                                <h6 class='mb-1'>Mobile App Integration</h6>
                                <small class='text-muted'>Lead: Marcus Johnson | Due: Mar 30, 2025</small>
                            </div>
                            <span class='badge bg-success'>On Track</span>
                        </div>
                        <div class='mb-2'>
                            <div class='d-flex justify-content-between align-items-center mb-1'>
                                <span class='progress-label text-muted'>COMPLETION</span>
                                <span class='progress-label text-success'>92%</span>
                            </div>
                            <div class='progress' style='height: 8px;'>
                                <div class='progress-bar bg-success' role='progressbar' style='width: 92%'></div>
                            </div>
                        </div>
                        <div class='d-flex gap-2 flex-wrap'>
                            <span class='badge bg-light text-dark'>iOS: 95%</span>
                            <span class='badge bg-light text-dark'>Android: 90%</span>
                            <span class='badge bg-light text-dark'>API: 100%</span>
                        </div>
                    </div>

                    <div class='list-group-item'>
                        <div class='d-flex justify-content-between align-items-start mb-3'>
                            <div>
                                <h6 class='mb-1'>Customer Analytics Dashboard</h6>
                                <small class='text-muted'>Lead: Emily Rodriguez | Due: Apr 22, 2025</small>
                            </div>
                            <span class='badge bg-warning text-dark'>At Risk</span>
                        </div>
                        <div class='mb-2'>
                            <div class='d-flex justify-content-between align-items-center mb-1'>
                                <span class='progress-label text-muted'>COMPLETION</span>
                                <span class='progress-label text-warning'>58%</span>
                            </div>
                            <div class='progress' style='height: 8px;'>
                                <div class='progress-bar bg-warning' role='progressbar' style='width: 58%'></div>
                            </div>
                        </div>
                        <div class='d-flex gap-2 flex-wrap'>
                            <span class='badge bg-light text-dark'>Data Pipeline: 65%</span>
                            <span class='badge bg-light text-dark'>UI: 50%</span>
                            <span class='badge bg-light text-dark'>Reports: 45%</span>
                        </div>
                        <div class='alert alert-warning mt-2 mb-0 py-2'>
                            <small><strong>Issue:</strong> Resource constraints affecting timeline. Review scheduled for next week.</small>
                        </div>
                    </div>

                    <div class='list-group-item'>
                        <div class='d-flex justify-content-between align-items-start mb-3'>
                            <div>
                                <h6 class='mb-1'>Security Infrastructure Upgrade</h6>
                                <small class='text-muted'>Lead: David Kim | Due: Mar 25, 2025</small>
                            </div>
                            <span class='badge bg-danger'>Delayed</span>
                        </div>
                        <div class='mb-2'>
                            <div class='d-flex justify-content-between align-items-center mb-1'>
                                <span class='progress-label text-muted'>COMPLETION</span>
                                <span class='progress-label text-danger'>42%</span>
                            </div>
                            <div class='progress' style='height: 8px;'>
                                <div class='progress-bar bg-danger' role='progressbar' style='width: 42%'></div>
                            </div>
                        </div>
                        <div class='d-flex gap-2 flex-wrap'>
                            <span class='badge bg-light text-dark'>Authentication: 60%</span>
                            <span class='badge bg-light text-dark'>Encryption: 40%</span>
                            <span class='badge bg-light text-dark'>Audit Logs: 25%</span>
                        </div>
                        <div class='alert alert-danger mt-2 mb-0 py-2'>
                            <small><strong>Critical:</strong> 7 days behind schedule. Additional resources allocated. Daily standup required.</small>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <div class='row g-4'>
            <div class='col-md-6'>
                <div class='card shadow-sm'>
                    <div class='card-header bg-white'>
                        <h5 class='mb-0'>Sprint Velocity</h5>
                    </div>
                    <div class='card-body'>
                        <div class='mb-3'>
                            <div class='d-flex justify-content-between mb-1'>
                                <span class='text-muted'>Current Sprint</span>
                                <strong>42 Story Points</strong>
                            </div>
                            <div class='progress' style='height: 20px;'>
                                <div class='progress-bar bg-success' style='width: 84%'>84% Complete</div>
                            </div>
                        </div>
                        <div class='mb-3'>
                            <div class='d-flex justify-content-between mb-1'>
                                <span class='text-muted'>Previous Sprint</span>
                                <strong>38 Story Points</strong>
                            </div>
                            <div class='progress' style='height: 20px;'>
                                <div class='progress-bar bg-info' style='width: 100%'>Completed</div>
                            </div>
                        </div>
                        <div class='mb-0'>
                            <div class='d-flex justify-content-between mb-1'>
                                <span class='text-muted'>Average Velocity</span>
                                <strong>40 Story Points</strong>
                            </div>
                            <div class='progress' style='height: 20px;'>
                                <div class='progress-bar bg-primary' style='width: 100%'>Baseline</div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <div class='col-md-6'>
                <div class='card shadow-sm'>
                    <div class='card-header bg-white'>
                        <h5 class='mb-0'>Team Capacity</h5>
                    </div>
                    <div class='card-body'>
                        <div class='d-flex justify-content-between align-items-center mb-3'>
                            <div>
                                <h6 class='mb-0'>Frontend Team</h6>
                                <small class='text-muted'>6 developers</small>
                            </div>
                            <span class='badge bg-success'>92% Utilized</span>
                        </div>
                        <div class='d-flex justify-content-between align-items-center mb-3'>
                            <div>
                                <h6 class='mb-0'>Backend Team</h6>
                                <small class='text-muted'>5 developers</small>
                            </div>
                            <span class='badge bg-success'>88% Utilized</span>
                        </div>
                        <div class='d-flex justify-content-between align-items-center mb-3'>
                            <div>
                                <h6 class='mb-0'>QA Team</h6>
                                <small class='text-muted'>3 testers</small>
                            </div>
                            <span class='badge bg-warning text-dark'>105% Utilized</span>
                        </div>
                        <div class='d-flex justify-content-between align-items-center mb-0'>
                            <div>
                                <h6 class='mb-0'>DevOps Team</h6>
                                <small class='text-muted'>2 engineers</small>
                            </div>
                            <span class='badge bg-danger'>110% Utilized</span>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</body>
</html>";

var pdf = renderer.RenderHtmlAsPdf(bootstrapProgress);
pdf.SaveAs("project-progress.pdf");
IRON VB CONVERTER ERROR developers@ironsoftware.com
$vbLabelText   $csharpLabel

Output: Professional project management PDF with Bootstrap 5's flexbox-based layouts, progress bar components, badge utilities, responsive card systems, and alert components—all rendering with perfect alignment, spacing, and color accuracy.

PDFSharpCore: No Native HTML Support

PDFSharpCore has no native HTML rendering engine. The library is designed exclusively for low-level PDF manipulation and drawing operations:

  • No Bootstrap support: Cannot process HTML/CSS frameworks at all
  • No flexbox or CSS Grid: No CSS rendering capabilities whatsoever
  • Manual construction only: Requires drawing text, shapes, and images using coordinate-based APIs
  • External tools required: Must use third-party HTML renderers or conversion services

The HtmlRenderer integration (third-party) provides only basic HTML support with severe limitations—approximately 70-80% CSS3 compatibility, no flexbox, no CSS Grid, and no modern framework support.

Development impact: Teams must either abandon HTML-based workflows entirely or integrate multiple tools (PDFSharpCore + external HTML renderer), adding complexity, maintenance burden, and potential compatibility issues between library versions.

有關詳細的 Bootstrap 框架兼容性和 CSS3 渲染功能,請參閱 Bootstrap &amp; Flexbox CSS 指南

Advanced Features Comparison

Text Extraction

One of the most common PDF operations is extracting text for indexing, analysis, or conversion. Here's how both libraries handle this task:

IronPDFText Extraction

IronPDF provides robust text extraction capabilities with a simple API:

using IronPdf;

// Extract all text from a PDF
var pdf = PdfDocument.FromFile("report.pdf");
string allText = pdf.ExtractAllText();

// Extract text from specific pages
for (int i = 0; i < pdf.PageCount; i++)
{
    string pageText = pdf.ExtractTextFromPage(i);
    Console.WriteLine($"Page {i + 1}: {pageText.Substring(0, Math.Min(100, pageText.Length))}...");
}

// Extract text from a specific region
var pageIndex = 0;
var region = new Rectangle(50, 50, 200, 100); // x, y, width, height
string regionText = pdf.ExtractTextFromPage(pageIndex, region);
using IronPdf;

// Extract all text from a PDF
var pdf = PdfDocument.FromFile("report.pdf");
string allText = pdf.ExtractAllText();

// Extract text from specific pages
for (int i = 0; i < pdf.PageCount; i++)
{
    string pageText = pdf.ExtractTextFromPage(i);
    Console.WriteLine($"Page {i + 1}: {pageText.Substring(0, Math.Min(100, pageText.Length))}...");
}

// Extract text from a specific region
var pageIndex = 0;
var region = new Rectangle(50, 50, 200, 100); // x, y, width, height
string regionText = pdf.ExtractTextFromPage(pageIndex, region);
Imports IronPdf

' Extract all text from a PDF
Private pdf = PdfDocument.FromFile("report.pdf")
Private allText As String = pdf.ExtractAllText()

' Extract text from specific pages
For i As Integer = 0 To pdf.PageCount - 1
	Dim pageText As String = pdf.ExtractTextFromPage(i)
	Console.WriteLine($"Page {i + 1}: {pageText.Substring(0, Math.Min(100, pageText.Length))}...")
Next i

' Extract text from a specific region
Dim pageIndex = 0
Dim region = New Rectangle(50, 50, 200, 100) ' x, y, width, height
Dim regionText As String = pdf.ExtractTextFromPage(pageIndex, region)
$vbLabelText   $csharpLabel

PDFSharpCore Text Extraction

PDFSharpCore has limited native text extraction capabilities. As noted in the comparison articles, it often produces fragmented or incomplete results:

// PDFSharpCore doesn't have reliable text extraction
// This is a significant limitation for many use cases
// PDFSharpCore doesn't have reliable text extraction
// This is a significant limitation for many use cases
' PDFSharpCore doesn't have reliable text extraction
' This is a significant limitation for many use cases
$vbLabelText   $csharpLabel

Watermarking

Watermarking PDFs is essential for branding and document security.

IronPDFWatermarking

using IronPdf;

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

// HTML-based watermark with full CSS support
string watermarkHtml = @"
    <div style='
        font-size: 48px;
        color: rgba(255, 0, 0, 0.3);
        transform: rotate(-45deg);
        text-align: center;
        font-weight: bold;
    '>
        CONFIDENTIAL
    </div>";

pdf.ApplyWatermark(watermarkHtml, 50, VerticalAlignment.Middle, HorizontalAlignment.Center);

// Image watermark
pdf.ApplyWatermark("logo.png", 30, VerticalAlignment.Bottom, HorizontalAlignment.Right);

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

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

// HTML-based watermark with full CSS support
string watermarkHtml = @"
    <div style='
        font-size: 48px;
        color: rgba(255, 0, 0, 0.3);
        transform: rotate(-45deg);
        text-align: center;
        font-weight: bold;
    '>
        CONFIDENTIAL
    </div>";

pdf.ApplyWatermark(watermarkHtml, 50, VerticalAlignment.Middle, HorizontalAlignment.Center);

// Image watermark
pdf.ApplyWatermark("logo.png", 30, VerticalAlignment.Bottom, HorizontalAlignment.Right);

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

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

' HTML-based watermark with full CSS support
Private watermarkHtml As String = "
    <div style='
        font-size: 48px;
        color: rgba(255, 0, 0, 0.3);
        transform: rotate(-45deg);
        text-align: center;
        font-weight: bold;
    '>
        CONFIDENTIAL
    </div>"

pdf.ApplyWatermark(watermarkHtml, 50, VerticalAlignment.Middle, HorizontalAlignment.Center)

' Image watermark
pdf.ApplyWatermark("logo.png", 30, VerticalAlignment.Bottom, HorizontalAlignment.Right)

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

PDFSharpCore Watermarking

using PdfSharpCore.Drawing;
using PdfSharpCore.Pdf;
using PdfSharpCore.Pdf.IO;

var document = PdfReader.Open("document.pdf", PdfDocumentOpenMode.Modify);

foreach (var page in document.Pages)
{
    var gfx = XGraphics.FromPdfPage(page, XGraphicsPdfPageOptions.Append);

    // Create watermark font
    var font = new XFont("Arial", 48);

    // Calculate rotation
    gfx.TranslateTransform(page.Width / 2, page.Height / 2);
    gfx.RotateTransform(-45);

    // Draw watermark
    var size = gfx.MeasureString("CONFIDENTIAL", font);
    gfx.DrawString("CONFIDENTIAL", font, 
        new XSolidBrush(XColor.FromArgb(128, 255, 0, 0)),
        new XRect(-size.Width / 2, -size.Height / 2, size.Width, size.Height),
        XStringFormats.Center);
}

document.Save("watermarked-pdfsharp.pdf");
using PdfSharpCore.Drawing;
using PdfSharpCore.Pdf;
using PdfSharpCore.Pdf.IO;

var document = PdfReader.Open("document.pdf", PdfDocumentOpenMode.Modify);

foreach (var page in document.Pages)
{
    var gfx = XGraphics.FromPdfPage(page, XGraphicsPdfPageOptions.Append);

    // Create watermark font
    var font = new XFont("Arial", 48);

    // Calculate rotation
    gfx.TranslateTransform(page.Width / 2, page.Height / 2);
    gfx.RotateTransform(-45);

    // Draw watermark
    var size = gfx.MeasureString("CONFIDENTIAL", font);
    gfx.DrawString("CONFIDENTIAL", font, 
        new XSolidBrush(XColor.FromArgb(128, 255, 0, 0)),
        new XRect(-size.Width / 2, -size.Height / 2, size.Width, size.Height),
        XStringFormats.Center);
}

document.Save("watermarked-pdfsharp.pdf");
Imports PdfSharpCore.Drawing
Imports PdfSharpCore.Pdf
Imports PdfSharpCore.Pdf.IO

Private document = PdfReader.Open("document.pdf", PdfDocumentOpenMode.Modify)

For Each page In document.Pages
	Dim gfx = XGraphics.FromPdfPage(page, XGraphicsPdfPageOptions.Append)

	' Create watermark font
	Dim font = New XFont("Arial", 48)

	' Calculate rotation
	gfx.TranslateTransform(page.Width \ 2, page.Height \ 2)
	gfx.RotateTransform(-45)

	' Draw watermark
	Dim size = gfx.MeasureString("CONFIDENTIAL", font)
	gfx.DrawString("CONFIDENTIAL", font, New XSolidBrush(XColor.FromArgb(128, 255, 0, 0)), New XRect(-size.Width \ 2, -size.Height \ 2, size.Width, size.Height), XStringFormats.Center)
Next page

document.Save("watermarked-pdfsharp.pdf")
$vbLabelText   $csharpLabel

Digital Signatures

Digital signatures ensure document authenticity and integrity.

IronPDFDigital Signatures

using IronPdf;
using IronPdf.Signing;

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

// Create a signature with certificate
var signature = new PdfSignature("certificate.pfx", "password")
{
    SigningContact = "legal@company.com",
    SigningLocation = "New York, NY",
    SigningReason = "Contract Approval"
};

// Add visual signature
var signatureImage = new PdfSignature("certificate.pfx", "password")
{
    SignatureImage = new PdfSignatureImage("signature.png", 0, 0, 200, 100)
};

// Apply signature to the last page
pdf.Sign(signature);
pdf.SaveAs("signed-contract.pdf");
using IronPdf;
using IronPdf.Signing;

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

// Create a signature with certificate
var signature = new PdfSignature("certificate.pfx", "password")
{
    SigningContact = "legal@company.com",
    SigningLocation = "New York, NY",
    SigningReason = "Contract Approval"
};

// Add visual signature
var signatureImage = new PdfSignature("certificate.pfx", "password")
{
    SignatureImage = new PdfSignatureImage("signature.png", 0, 0, 200, 100)
};

// Apply signature to the last page
pdf.Sign(signature);
pdf.SaveAs("signed-contract.pdf");
Imports IronPdf
Imports IronPdf.Signing

Private pdf = PdfDocument.FromFile("contract.pdf")

' Create a signature with certificate
Private signature = New PdfSignature("certificate.pfx", "password") With {
	.SigningContact = "legal@company.com",
	.SigningLocation = "New York, NY",
	.SigningReason = "Contract Approval"
}

' Add visual signature
Private signatureImage = New PdfSignature("certificate.pfx", "password") With {.SignatureImage = New PdfSignatureImage("signature.png", 0, 0, 200, 100)}

' Apply signature to the last page
pdf.Sign(signature)
pdf.SaveAs("signed-contract.pdf")
$vbLabelText   $csharpLabel

PDFSharpCore Digital Signatures

PDFSharpCore does not support digital signatures natively, which is a significant limitation for business applications requiring document security.

Form Handling

Working with PDF forms is crucial for interactive documents.

IronPDFForm Handling

using IronPdf;

// Create a form from HTML
var html = @"
    <form>
        <label>Name: <input type='text' name='fullName' required></label><br>
        <label>Email: <input type='email' name='email' required></label><br>
        <label>Subscribe: <input type='checkbox' name='subscribe' value='yes'></label><br>
        <label>
            Plan:
            <select name='plan'>
                <option value='basic'>Basic</option>
                <option value='pro'>Professional</option>
                <option value='enterprise'>Enterprise</option>
            </select>
        </label>
    </form>";

var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderHtmlAsPdf(html);

// Fill existing form
var filledPdf = PdfDocument.FromFile("application-form.pdf");
filledPdf.Form.FindFormField("fullName").Value = "John Doe";
filledPdf.Form.FindFormField("email").Value = "john@example.com";
filledPdf.Form.FindFormField("subscribe").Value = "yes";

filledPdf.SaveAs("completed-application.pdf");
using IronPdf;

// Create a form from HTML
var html = @"
    <form>
        <label>Name: <input type='text' name='fullName' required></label><br>
        <label>Email: <input type='email' name='email' required></label><br>
        <label>Subscribe: <input type='checkbox' name='subscribe' value='yes'></label><br>
        <label>
            Plan:
            <select name='plan'>
                <option value='basic'>Basic</option>
                <option value='pro'>Professional</option>
                <option value='enterprise'>Enterprise</option>
            </select>
        </label>
    </form>";

var renderer = new ChromePdfRenderer();
var pdf = renderer.RenderHtmlAsPdf(html);

// Fill existing form
var filledPdf = PdfDocument.FromFile("application-form.pdf");
filledPdf.Form.FindFormField("fullName").Value = "John Doe";
filledPdf.Form.FindFormField("email").Value = "john@example.com";
filledPdf.Form.FindFormField("subscribe").Value = "yes";

filledPdf.SaveAs("completed-application.pdf");
Imports IronPdf

' Create a form from HTML
Private html = "
    <form>
        <label>Name: <input type='text' name='fullName' required></label><br>
        <label>Email: <input type='email' name='email' required></label><br>
        <label>Subscribe: <input type='checkbox' name='subscribe' value='yes'></label><br>
        <label>
            Plan:
            <select name='plan'>
                <option value='basic'>Basic</option>
                <option value='pro'>Professional</option>
                <option value='enterprise'>Enterprise</option>
            </select>
        </label>
    </form>"

Private renderer = New ChromePdfRenderer()
Private pdf = renderer.RenderHtmlAsPdf(html)

' Fill existing form
Private filledPdf = PdfDocument.FromFile("application-form.pdf")
filledPdf.Form.FindFormField("fullName").Value = "John Doe"
filledPdf.Form.FindFormField("email").Value = "john@example.com"
filledPdf.Form.FindFormField("subscribe").Value = "yes"

filledPdf.SaveAs("completed-application.pdf")
$vbLabelText   $csharpLabel

Performance Benchmarks

Based on extensive testing and community feedback, here are performance comparisons:

HTML to PDF Rendering

Test Case IronPDF PDFSharpCore (with HtmlRenderer)
Simple HTML (1 page) 0.8-1.2s 0.3-0.5s
Complex HTML with CSS3 1.5-2s Often fails or renders incorrectly
JavaScript charts 2-3s Not supported
100-page report 15-20s 45-60s
Memory usage 150-200MB 80-120MB

Key Performance Insights

  1. IronPDF excels at:

    • Complex HTML rendering with full browser compatibility
    • Parallel processing for batch operations
    • Consistent performance across different content types
    • Async operations for better scalability
  2. PDFSharpCore performs better for:
    • Simple programmatic PDF creation
    • Lower memory footprint
    • Basic document modifications

Real-World Performance Example

//IronPDF- Batch processing with parallel execution
using IronPdf;
using System.Threading.Tasks;

class BatchProcessor
{
    public static async Task ProcessInvoicesAsync(List<string> htmlInvoices)
    {
        var renderer = new ChromePdfRenderer();

        // Process multiple PDFs in parallel
        var tasks = htmlInvoices.Select(async (html, index) =>
        {
            var pdf = await renderer.RenderHtmlAsPdfAsync(html);
            await pdf.SaveAsAsync($"invoice-{index}.pdf");
        });

        await Task.WhenAll(tasks);
    }
}
//IronPDF- Batch processing with parallel execution
using IronPdf;
using System.Threading.Tasks;

class BatchProcessor
{
    public static async Task ProcessInvoicesAsync(List<string> htmlInvoices)
    {
        var renderer = new ChromePdfRenderer();

        // Process multiple PDFs in parallel
        var tasks = htmlInvoices.Select(async (html, index) =>
        {
            var pdf = await renderer.RenderHtmlAsPdfAsync(html);
            await pdf.SaveAsAsync($"invoice-{index}.pdf");
        });

        await Task.WhenAll(tasks);
    }
}
IRON VB CONVERTER ERROR developers@ironsoftware.com
$vbLabelText   $csharpLabel

Real-World Use Cases

什麼時候選擇 IronPDF

IronPDF is ideal for:

  1. Web Application Integration

    • Converting dynamic web content to PDF
    • Generating reports from web dashboards
    • Creating invoices from HTML templates
  2. Enterprise Document Management

    • Implementing document workflows with digital signatures
    • Creating secure, encrypted PDFs for sensitive data
    • Batch processing large volumes of documents
  3. SaaS Applications

    • Multi-tenant PDF generation
    • Cloud-native deployments on Azure/AWS
    • High-performance async processing
  4. Complex Reporting
    • Financial statements with charts and graphs
    • Marketing materials with rich media
    • Technical documentation with code highlighting

When to Choose PDFSharpCore

PDFSharpCore is suitable for:

  1. Budget-Conscious Projects

    • Open-source projects with no licensing budget
    • Simple PDF generation needs
    • Academic or personal projects
  2. Basic PDF Operations

    • Creating simple text-based PDFs
    • Basic document merging
    • Adding simple graphics or shapes
  3. Lightweight Applications
    • Embedded systems with memory constraints
    • Simple command-line tools
    • Microservices with minimal dependencies

授權和定價

IronPDFLicensing

IronPDF offers flexible licensing options (pricing as of 2025):

  • Lite許可證:$799(1位開發人員,1個地點,1個項目)
  • Plus許可證:$1,199(3位開發人員,3個地點,3個項目)
  • 專業許可證:$2,399(10位開發人員,10個地點,10個項目)
  • Free Trial: 30-day fully functional trial

Additional benefits:

  • Perpetual licensing (one-time purchase)
  • Royalty-free redistribution available
  • 24/5 engineering support included
  • Free updates for one year
  • Iron Suite bundle available for additional savings

PDFSharpCore Licensing

PDFSharpCore is completely free under the MIT license:

  • No licensing costs
  • No restrictions on commercial use
  • Community support only
  • No guaranteed updates or bug fixes

Developer Experience

Documentation and Resources

IronPDF provides:

PDFSharpCore offers:

  • Basic GitHub documentation
  • Community examples
  • Limited official tutorials

Support Comparison

Support Type IronPDF PDFSharpCore
Professional Support 24/5 included None
Response Time 24-48 hours Community-dependent
Direct Engineering Access Yes No
Bug Fix Guarantees Yes No

結論

BothIronPDFand PDFSharpCore serve important roles in the .NET PDF ecosystem, but they target different needs and use cases.

ChooseIronPDFwhen:

  • You need robust HTML to PDF conversion with full CSS3 and JavaScript support
  • Your project requires advanced features like digital signatures, encryption, or form handling
  • You're building enterprise or commercial applications
  • You value comprehensive documentation and professional support
  • Performance and reliability are critical
  • You need cloud-ready deployment options

Choose PDFSharpCore when:

  • You're working on a budget-constrained or open-source project
  • Your PDF needs are simple and don't require HTML rendering
  • You prefer manual control over PDF construction
  • Memory footprint is a critical concern
  • You're comfortable with community support

IronPDF's modern approach to PDF generation, combined with its extensive feature set and excellent support, makes it the superior choice for most professional applications. While it requires a license investment, the time saved in development and the reliability gained often justify the cost for commercial projects.

準備好體驗不同? Start your free 30-day trial of IronPDF and see how it can transform your PDF generation workflow. With comprehensive documentation, responsive support, and a feature-rich API,IronPDFempowers developers to create professional PDFs with minimal effort.

立即開始使用 IronPDF。
green arrow pointer

請注意PDFSharpCore is a registered trademark of its respective owner. This site is not affiliated with, endorsed by, or sponsored by PDFSharpCore. 所有產品名稱、徽標和品牌均為其各自所有者的財產。 比較僅供信息參考,並反映撰寫時公開可用的信息。

常見問題解答

怎樣在 C# 中將 HTML 轉換為 PDF?

您可以使用 IronPDF 的 RenderHtmlAsPdf 方法將 HTML 字串轉換為 PDF。此方法支援完整的 CSS3 和 JavaScript 執行,確保高保真渲染。

IronPDF 和 PDFSharpCore 之間的主要差異是什麼?

IronPDF 是一個商業函式庫,具有先進的功能,如 HTML 至 PDF 轉換、數位簽名和雲平台優化。PDFSharpCore 是開源的,專注於通過手動繪圖命令創建基本 PDF 並且缺乏原生 HTML 至 PDF 轉換。

我可以使用這些函式庫從 PDF 中提取文本嗎?

IronPDF 提供強大的文本提取能力,具有 ExtractAllText()ExtractTextFromPage() 等方法,保持文檔結構。PDFSharpCore 的文本提取功能有限,通常會導致輸出碎片化。

在 C# 中將數位簽名添加到 PDF 的最佳方式是什麼?

IronPDF 提供全面的數位簽名支持,包括視覺簽名和使用證書。它提供了自定義選項來簽署 PDF,適合安全的文檔工作流程。

這些函式庫在 HTML 渲染速度方面的表現如何?

IronPDF 通常在約 0.8-2 秒內完成複雜的 HTML 到 PDF 渲染,支持完整的 CSS3 和 JavaScript。PDFSharpCore 在簡單程式化 PDF 創建方面較快,但不支持現代網頁技術,影響其渲染能力。

是否有可用於評估 PDF 函式庫的試用版本?

IronPDF 提供 30 天免費試用,允許您探索所有功能,包括 HTML 到 PDF 轉換。PDFSharpCore 在 MIT 授權下免費提供基本功能,沒有試用期。

哪個函式庫更適合處理 PDF 表單?

IronPDF 在表單處理方面表現傑出,具有從 HTML 創建和填寫表單以及提取表單數據的能力。PDFSharpCore 支持基本的表單處理,但需要手動創建字段,無法提供相同程度的自動化。

每個函式庫如何支持跨平台開發?

IronPDF 和 PDFSharpCore 都支持 Windows、Linux 和 macOS。IronPDF 針對 Azure 和 AWS 等雲平台進行了優化配置,而 PDFSharpCore 可能需要為雲環境進行額外的設置。

使用這些函式庫我能期望得到什麼樣的支持?

IronPDF 提供 24/5 的專業工程支持,響應時間為 24-48 小時,並提供詳細文檔。PDFSharpCore 通過論壇和 GitHub 提供社群支持,沒有保證的響應時間。

每個函式庫在處理複雜 PDF 操作的性能如何?

IronPDF 在處理複雜的 HTML 渲染方面表現優異,並支持批處理操作的並行處理,提供卓越的吞吐量。PDFSharpCore 在簡單文檔的內存效率方面具有優勢,但缺乏高級渲染能力。

Jacob Mellor, Team Iron 首席技术官
首席技术官

Jacob Mellor 是 Iron Software 的首席技術官,作為 C# PDF 技術的先鋒工程師。作為 Iron Software 核心代碼的原作者,他自開始以來塑造了公司產品架構,與 CEO Cameron Rimington 一起將其轉變為一家擁有超過 50 名員工的公司,為 NASA、特斯拉 和 全世界政府機構服務。

Jacob 持有曼徹斯特大學土木工程一級榮譽学士工程學位(BEng) (1998-2001)。他於 1999 年在倫敦開設了他的第一家軟件公司,並於 2005 年製作了他的首個 .NET 組件,專注於解決 Microsoft 生態系統內的複雜問題。

他的旗艦產品 IronPDF & IronSuite .NET 庫在全球 NuGet 被安裝超過 3000 萬次,其基礎代碼繼續為世界各地的開發工具提供動力。擁有 25 年的商業經驗和 41 年的編碼專業知識,Jacob 仍專注於推動企業級 C#、Java 及 Python PDF 技術的創新,同時指導新一代技術領袖。