A Comparison Between IronPDF & ComPDFKit
IronPDF excels over ComPDFKit for C# PDF generation with native Chromium-based HTML rendering, complete Bootstrap support, complete documentation, and superior .NET integration, while ComPDFKit requires external API calls for HTML conversion and lacks advanced CSS framework compatibility.
PDF, short for Portable Document Format, is a file type created by Adobe to ensure uniformity in document sharing. This format maintains layout, text, and images consistently across various devices and operating systems. PDFs provide security, interactive features, and compact file sizes, making them ideal for distributing documents without content alteration.
For developers using C#, PDF libraries provide solutions for working with PDF files. These libraries enable document creation, content modification, and extraction of text and images. They support features like form handling, digital signatures, and cross-platform compatibility. Designed for improve performance, these libraries enable efficient PDF processing.
This article compares two C# PDF libraries: IronPDF and ComPDFKit. This comparison covers features, functionality, code examples, and licensing. By examining these aspects, developers can determine which library best suits their PDF-related projects.
Quick Comparison Overview
Before diving into detailed analysis, here's a complete comparison of key features:
| Feature | IronPDF | ComPDFKit |
|---|---|---|
| HTML to PDF | Native Chromium engine | External API required |
| Bootstrap Support | Full CSS3/Flexbox support | Limited CSS framework support |
| Installation | Single NuGet package | Multiple packages needed |
| Documentation | Extensive with 500+ examples | Basic documentation |
| Support | 24/5 dedicated engineering support | Standard email support |
| Pricing Model | Perpetual license from $749 | Quote-based pricing |
| Cross-Platform | Windows, Linux, macOS, Docker, Azure | Windows, Linux, macOS |
| Performance | Optimized async/multithreading | Standard synchronous processing |
| Enterprise Features | PDF/A, PDF/UA, HSM signing | Basic PDF/A support |
| Learning Curve | Minimal - intuitive API | Moderate - complex API structure |
- PDF Viewing: ComPDFKit provides a powerful PDF viewer that allows users to view PDF documents with high fidelity. The viewer supports smooth scrolling, zooming, and navigation, ensuring a seamless user experience.
- Annotations: The library includes tools to integrate PDF annotations smoothly. Users can highlight text, add comments, and create various types of annotations, which are essential for collaborative workflows.
- Form Handling: The library offers extensive support for interactive forms. Developers can create, fill, and extract data from PDF forms, making it ideal for applications that require form processing.
- PDF Editing: ComPDFKit allows for extensive PDF editing capabilities, including modifying text, images, and other content within PDF files. This feature is useful for applications that need to update or customize existing PDF documents.
- Conversion: The library supports converting PDF files to and from various formats such as Word, Excel, PowerPoint, and images. This flexibility is vital for applications that need to transform PDF content for different uses.
- Security: ComPDFKit includes robust security features such as encryption and permissions management. Developers can secure PDF documents to protect sensitive information from unauthorized access.
- Optical Character Recognition (OCR): The library includes OCR capabilities to convert scanned documents into editable and searchable PDFs. This feature is essential for digitizing paper documents and making them accessible electronically.

ComPDFKit PDF SDK is a reliable C# PDF SDK that allows developers to integrate complete PDF functionalities into their applications. This library supports a wide range of PDF functions necessary for handling PDF documents programmatically. It is designed for use in various environments, including web, desktop, and mobile platforms, making it a versatile tool for developers working on cross-platform projects. The example solution includes multiple functions that developers can select and test.
What Key Features Does ComPDFKit Offer?
Core Capabilities:
- PDF Viewing: Provides a effective viewer with smooth scrolling, zooming, and navigation capabilities
- Annotations: Includes tools for highlighting text, adding comments, and creating various annotation types
- Form Handling: Offers support for creating, filling, and extracting data from interactive PDF forms
- PDF Editing: Allows modification of text, images, and other content within existing PDF documents
- Conversion: Supports converting PDFs to Word, Excel,
PowerPoint, and image formats - Security: Includes encryption and permissions management to protect sensitive information
- Optical Character Recognition (OCR): Converts scanned documents into editable and searchable PDFs
Why Consider ComPDFKit's Architecture?
- HTML to PDF Conversion: IronPDF excels in converting HTML, CSS, and JavaScript content into high-quality PDF documents. This feature supports HTML strings to PDFs, URLs, ASPX webforms, and MVC views, making it a flexible solution for various web-based content.
- PDF Editing: The library offers extensive editing capabilities, including adding, copying, and deleting pages, merging and splitting PDFs, and manipulating text and images. Developers can also add headers, footers, watermarks, and digital signatures to PDF documents.
- Form Handling: IronPDF supports smart forms creating and programmatically filling PDF forms. This feature is essential for applications that require dynamic form generation and data extraction from user-submitted forms.
- Security Features: IronPDF provides robust security options, such as setting passwords and permissions, encrypting documents, and adding digital signatures. These features ensure that sensitive information within PDF documents is protected against unauthorized access.
- OCR and Data Extraction: The library includes Optical Character Recognition (OCR) capabilities, allowing the conversion of scanned documents into editable and searchable PDFs. Additionally, IronPDF can extract text, images, and other data from existing PDFs, facilitating content reuse and analysis.
- Image Conversion: IronPDF supports converting various image formats, including JPG, PNG, GIF, BMP, and SVG, into PDF documents. It also offers the ability to render PDF pages as images, which is useful for applications requiring visual previews of PDF content.
- Cross-Platform Compatibility: IronPDF is compatible with multiple .NET platforms, including .NET Core, .NET Framework, and .NET Standard. It supports deployment on Windows, Linux, macOS, and Azure, making it a versatile choice for developers working in diverse environments.
- Performance Optimization: The library is designed for high performance, with support for multithreading and asynchronous operations. This ensures that PDF processing tasks are executed efficiently, even in applications with high workloads.
- Comprehensive Documentation and Support: IronPDF provides detailed documentation and numerous code examples, making it easy for developers to get started and implement its features. Additionally, it offers technical support to assist with any issues that may arise during development.
For enterprise applications requiring reliable annotation features, ComPDFKit provides basic functionality. Advanced form creation capabilities may require additional programming effort. While functional for OCR tasks, developers seeking advanced text recognition should evaluate alternatives like IronOCR for superior accuracy.
What Are ComPDFKit's Limitations?
Despite its complete feature set, ComPDFKit presents several limitations for enterprise development:
- HTML Rendering: No native HTML to PDF conversion - requires external API calls
- CSS Support: Limited modern CSS framework compatibility
- Performance: Lacks built-in async/multithreading optimization
- Documentation: Basic examples without complete troubleshooting guides
- Integration Complexity: Multiple packages required for full functionality
What Is IronPDF Library?

IronPDF is a versatile PDF library for .NET that allows developers to create, edit, and manage PDF documents using C#. It provides complete PDF functions through simplified APIs. The library excels at PDF generation by rendering from HTML, CSS, JavaScript, and various image formats. This makes it an ideal tool for developers integrating reliable PDF functionality into .NET applications.
What Key Features Does IronPDF Offer?
Advanced Capabilities:
- HTML to PDF Conversion: Converts HTML, CSS, and JavaScript into high-quality PDFs using Chrome rendering engine
- PDF Editing: Complete page manipulation including merging, splitting, and content modification
- Form Handling: Complete support for creating and programmatically filling PDF forms
- Security Features: Advanced PDF permissions and passwords with 256-bit encryption
- OCR and Data Extraction: Built-in text and image extraction with parsing capabilities
- Image Conversion: Native support for image to PDF and PDF rasterization
- Cross-Platform Compatibility: Optimized for Windows, Linux, macOS, and Azure
- Performance Optimization: Native async/multithreading support for high-performance scenarios
- Enterprise Features: PDF/A compliance, digital signatures, and HSM integration
Why Choose IronPDF for Production Systems?
IronPDF's architecture prioritizes performance and reliability for production environments:
- Chromium Rendering Engine: Ensures pixel-perfect HTML conversion
- Memory Management: Optimized for handling large documents
- Thread Safety: Built for concurrent operations in web applications
- Complete Documentation: Over 500 code examples and tutorials
- Enterprise Support: Dedicated engineering support for complex scenarios
What Makes IronPDF Enterprise-Ready?
IronPDF distinguishes itself through production-focused features:
- Deployment Flexibility: Native support for Docker containers and AWS Lambda
- Compliance Standards: Built-in PDF/UA support for accessibility requirements
- Advanced Security: Sanitization capabilities for removing malicious content
- Performance Tools: Linearization for fast web viewing
- Version Control: Revision history management for document tracking
How Do I Create a New Visual Studio Project?
Before exploring coding examples, developers should create a new Visual Studio project. This guide outlines setting up a C# console application in Visual Studio.
Why Do I Need Visual Studio Installed?
Visual Studio provides the improve IDE for C# projects. Download it from the Visual Studio Downloads page. The IDE offers integrated debugging, IntelliSense, and package management essential for PDF development.
What Project Configuration Works Best?
After installation, open Visual Studio. Sign in or continue without signing in when using Visual Studio Community. Follow these configuration steps:
Click "Create a new project" or navigate to File > New > Project.

Search for Console app and select Console Application from search results.

- Open NuGet Package Manager: In Solution Explorer, right-click on "References" and select "Manage NuGet Packages."
- Search and Install: Search for "ComPDFKit" in the NuGet Package Manager. Select the appropriate package (e.g., ComPDFKit.NetFramework or ComPDFKit.Conversion.NetFramework) and click "Install."
What Are Essential Project Settings?
- Verify Installation: Ensure the package appears under "References" in Solution Explorer.
- Platform Target: Set to x64 for large document processing
- Output Type: Console Application for testing, Class Library for production
- Framework Version: .NET 6+ recommended for best performance
- NuGet Package Management: Enable package restore for dependency management
- Download Package: Obtain the ComPDFKit.NetFramework.nupkg file from the official ComPDFKit website.
- Configure NuGet Source: Create or edit a nuget.config file in your project directory to include the path to the local package.
Integrating IronPDF into projects can be accomplished through various methods. For a complete installation overview, refer to official documentation. The library supports multiple installation approaches tailored to different development workflows.
Install Local Package: Reopen your solution in Visual Studio, go to "Manage NuGet Packages," and select your local package source. Install the ComPDFKit package from the local source.
Visual Studio NuGet Package Manager: Right-click "Dependencies" in the solution and select "Manage NuGet Packages." In the "Browse" tab, search for "IronPDF" and install the latest version. For advanced NuGet installation options, consult the detailed guide.
- Obtain License: Contact the ComPDFKit team to get a trial or full license.
Apply the License in Code:
Package Manager Console: Use the NuGet Package Manager Console via Tools > NuGet Package Manager > Package Manager Console. Execute the command:
_CODEBLOCK0
This provides quick library installation through command line interface.

Direct Download Method: Visit the IronPDF NuGet package page. Download the package file, double-click to add it to the project, then reload the solution.
- Manual Installation: Download the latest IronPDF version directly. Follow provided instructions for manual Visual Studio integration. For Windows-specific installation, see the Windows installer guide.
Why Choose Specific Installation Approaches?
Different installation methods suit various scenarios:
- NuGet Package Manager: Best for Visual Studio users with internet access
- Package Manager Console: Ideal for scripted deployments and CI/CD pipelines
- Direct Download: Suitable for offline development environments
- Manual Installation: Required for custom deployment configurations
These methods efficiently integrate IronPDF into .NET projects. For quickstart instructions, visit the getting started guide. Platform-specific guides cover F# integration and VB.NET usage.
How Do I Install ComPDFKit C#?
Two main methods exist for adding ComPDFKit to projects: NuGet Package Manager or local package installation. The installation process requires more steps compared to IronPDF's single-package approach.
When Should I Use NuGet Package Manager?
- Open NuGet Package Manager: Right-click "References" in Solution Explorer and select "Manage NuGet Packages."
- Search and Install: Search "ComPDFKit" in Package Manager. Select the appropriate package (ComPDFKit.
NetFrameworkor ComPDFKit.Conversion.NetFramework) and click "Install."

- Verify Installation: Ensure the package appears under "References" in Solution Explorer. Multiple packages may be required for full functionality.
When Should I Use a Local Package?
Local package installation suits restricted environments:
- Download Package: Obtain ComPDFKit.
NetFramework.nupkg from the official ComPDFKit website. Configure NuGet Source: Create or edit
nuget.configin the project directory to include the local package path._CODEBLOCK1
- Install Local Package: Reopen the solution, navigate to "Manage NuGet Packages," select the local package source, and install ComPDFKit.
How Do I Apply My License Key?
License implementation differs significantly between libraries:
- Obtain License: Contact ComPDFKit for trial or full license.
Apply License in Code:
_CODEBLOCK2
Add this method to verify licensing. For IronPDF's simpler license implementation, see license keys documentation. IronPDF requires only setting
License.LicenseKeyproperty, simplify the licensing process.
How Do I Convert HTML to PDF?
Converting HTML to PDF represents a common requirement for generating reports, invoices, or documentation from web content. Both IronPDF and ComPDFKit offer solutions, though their approaches differ significantly. IronPDF provides native conversion while ComPDFKit requires external API calls.
How Does IronPDF Handle HTML to PDF Conversion?
IronPDF uses a Chrome-based rendering engine for high-quality output. This process renders HTML, CSS, and JavaScript accurately into PDF format. The library supports HTML strings, HTML files, and URLs.
Basic HTML string to PDF conversion example:
using IronPdf;
using System;
class Program
{
static void Main()
{
// Define your HTML string
string htmlString = @"
<h1>Hello, IronPDF!</h1>
<p>This is a simple PDF created from an HTML string.</p>";
var renderer = new ChromePdfRenderer();
// Convert the HTML string to a PDF document
PdfDocument pdf = renderer.RenderHtmlAsPdf(htmlString);
// Save the PDF document to a file
string outputPath = "sample.pdf";
pdf.SaveAs(outputPath);
Console.WriteLine($"PDF created successfully and saved to {outputPath}");
}
}using IronPdf;
using System;
class Program
{
static void Main()
{
// Define your HTML string
string htmlString = @"
<h1>Hello, IronPDF!</h1>
<p>This is a simple PDF created from an HTML string.</p>";
var renderer = new ChromePdfRenderer();
// Convert the HTML string to a PDF document
PdfDocument pdf = renderer.RenderHtmlAsPdf(htmlString);
// Save the PDF document to a file
string outputPath = "sample.pdf";
pdf.SaveAs(outputPath);
Console.WriteLine($"PDF created successfully and saved to {outputPath}");
}
}
IronPDF also converts HTML files directly, supporting CSS and JavaScript inclusion:
using IronPdf;
using System;
class Program
{
static void Main()
{
var renderer = new ChromePdfRenderer();
// Convert the HTML file to a PDF document
PdfDocument pdf = renderer.RenderHtmlFileAsPdf("index.html");
// Save the PDF document to a file
string outputPath = "HTML File.pdf";
pdf.SaveAs(outputPath);
Console.WriteLine($"PDF created successfully and saved to {outputPath}");
}
}using IronPdf;
using System;
class Program
{
static void Main()
{
var renderer = new ChromePdfRenderer();
// Convert the HTML file to a PDF document
PdfDocument pdf = renderer.RenderHtmlFileAsPdf("index.html");
// Save the PDF document to a file
string outputPath = "HTML File.pdf";
pdf.SaveAs(outputPath);
Console.WriteLine($"PDF created successfully and saved to {outputPath}");
}
}
What Advanced HTML Features Does IronPDF Support?
IronPDF's Chromium engine handles complex web technologies:
- JavaScript Rendering: Full support for JavaScript execution including frameworks
- CSS3 Support: Complete responsive CSS rendering
- Asset Management: Base URLs and asset encoding for resource loading
- Custom Layouts: Custom paper sizes and page orientation
- Advanced Formatting: Page breaks control and custom margins
- International Support: UTF-8 and international languages
- Performance Options: WaitFor delays for dynamic content
How Does ComPDFKit Handle HTML to PDF Conversion?
- Send HTML Content: Create an HTTP POST request to the ComPDFKit API endpoint with your HTML content.
- Receive PDF Output: The API processes the HTML content and returns the generated PDF file.
To use ComPDFKit's HTML to PDF API:
- Send HTML Content: Create an HTTP POST request with HTML content
- Receive PDF Output: The API processes content and returns the generated PDF
Example structure for API requests in C#:
using System;
using System.Net.Http;
using System.Threading.Tasks;
public class HtmlToPdfExample
{
public static async Task ConvertHtmlToPdfAsync()
{
using (var client = new HttpClient())
{
var content = new StringContent("<h1>Hello World</h1>");
var response = await client.PostAsync("___PROTECTED_URL_137___", content);
var pdfBytes = await response.Content.ReadAsByteArrayAsync();
System.IO.File.WriteAllBytes("output.pdf", pdfBytes);
}
}
}using System;
using System.Net.Http;
using System.Threading.Tasks;
public class HtmlToPdfExample
{
public static async Task ConvertHtmlToPdfAsync()
{
using (var client = new HttpClient())
{
var content = new StringContent("<h1>Hello World</h1>");
var response = await client.PostAsync("___PROTECTED_URL_137___", content);
var pdfBytes = await response.Content.ReadAsByteArrayAsync();
System.IO.File.WriteAllBytes("output.pdf", pdfBytes);
}
}
}What Are the Limitations of API-Based Conversion?
ComPDFKit's API approach introduces several challenges:
- Network Dependency: Requires internet connectivity for basic operations
- Latency Issues: API round-trips add processing time
- Limited Control: Cannot customize rendering engine behavior
- Security Concerns: Sensitive data transmitted to external servers
- Rate Limiting: API quotas may restrict high-volume processing
- Lack of Documentation: Limited C# implementation examples
Does Bootstrap CSS Work with PDF Generation?
Modern e-commerce and business applications use Bootstrap extensively for consistent UI design. When generating invoices, receipts, and reports as PDFs, maintaining Bootstrap styling ensures brand consistency. IronPDF's Chromium engine provides complete Bootstrap support, while ComPDFKit's API-based approach shows limitations with complex CSS frameworks.
How Does IronPDF Handle Bootstrap Styling?
IronPDF use Chromium's rendering engine, providing pixel-perfect Bootstrap support across all versions (Bootstrap 5, 4, and 3). The library handles Flexbox layouts, CSS Grid, responsive utilities, and custom components seamlessly. For advanced CSS rendering, see the rendering options guide.
using IronPdf;
// Set license
IronPdf.License.LicenseKey = "License-Key";
var renderer = new ChromePdfRenderer();
// Bootstrap 5 e-commerce invoice example
string bootstrapInvoice = @"
<!DOCTYPE html>
<html lang='en'>
<head>
<meta charset='utf-8'>
<meta name='viewport' content='width=device-width, initial-scale=1'>
<link href='___PROTECTED_URL_138___ rel='stylesheet'>
<style>
@page { margin: 20mm; }
.invoice-header { border-bottom: 3px solid #0d6efd; }
.product-row { border-bottom: 1px solid #dee2e6; }
.total-section { background-color: #f8f9fa; }
</style>
</head>
<body>
<div class='container-fluid p-4'>
<!-- Invoice Header -->
<div class='row invoice-header pb-4 mb-4'>
<div class='col-8'>
<h1 class='display-4 text-primary'>INVOICE</h1>
<p class='text-muted mb-0'>TechStore Inc.</p>
<p class='text-muted mb-0'>123 Commerce Street, Tech City, TC 12345</p>
<p class='text-muted'>Email: sales@techstore.com | Phone: (555) 123-4567</p>
</div>
<div class='col-4 text-end'>
<p class='mb-1'><strong>Invoice #:</strong> INV-2024-1089</p>
<p class='mb-1'><strong>Date:</strong> October 27, 2024</p>
<p class='mb-1'><strong>Due Date:</strong> November 27, 2024</p>
<span class='badge bg-success'>PAID</span>
</div>
</div>
<!-- Bill To Section -->
<div class='row mb-4'>
<div class='col-6'>
<h5 class='text-primary'>Bill To:</h5>
<p class='mb-1'><strong>Acme Corporation</strong></p>
<p class='mb-1'>456 Business Ave</p>
<p class='mb-1'>Enterprise City, EC 67890</p>
<p class='mb-0'>contact@acmecorp.com</p>
</div>
<div class='col-6 text-end'>
<h5 class='text-primary'>Payment Method:</h5>
<p class='mb-1'>Credit Card ending in 4242</p>
<p class='mb-0'>Transaction ID: TXN-9876543210</p>
</div>
</div>
<!-- Products Table -->
<div class='row mb-4'>
<div class='col-12'>
<table class='table'>
<thead class='table-primary'>
<tr>
<th scope='col'>#</th>
<th scope='col'>Product</th>
<th scope='col'>Description</th>
<th scope='col' class='text-center'>Qty</th>
<th scope='col' class='text-end'>Unit Price</th>
<th scope='col' class='text-end'>Amount</th>
</tr>
</thead>
<tbody>
<tr class='product-row'>
<td>1</td>
<td><strong>IronPDF Pro License</strong></td>
<td>Professional developer license with 1 year support</td>
<td class='text-center'>1</td>
<td class='text-end'>$2,999.00</td>
<td class='text-end'><strong>$2,999.00</strong></td>
</tr>
<tr class='product-row'>
<td>2</td>
<td><strong>Priority Support</strong></td>
<td>24/7 priority technical support package</td>
<td class='text-center'>1</td>
<td class='text-end'>$999.00</td>
<td class='text-end'><strong>$999.00</strong></td>
</tr>
<tr class='product-row'>
<td>3</td>
<td><strong>Training Package</strong></td>
<td>On-site developer training (2 days)</td>
<td class='text-center'>1</td>
<td class='text-end'>$1,500.00</td>
<td class='text-end'><strong>$1,500.00</strong></td>
</tr>
</tbody>
</table>
</div>
</div>
<!-- Totals Section -->
<div class='row justify-content-end mb-4'>
<div class='col-md-6'>
<div class='card total-section'>
<div class='card-body'>
<div class='row mb-2'>
<div class='col-6'><strong>Subtotal:</strong></div>
<div class='col-6 text-end'>$5,498.00</div>
</div>
<div class='row mb-2'>
<div class='col-6'><strong>Tax (8.5%):</strong></div>
<div class='col-6 text-end'>$467.33</div>
</div>
<div class='row mb-2'>
<div class='col-6 text-success'><strong>Discount (10%):</strong></div>
<div class='col-6 text-end text-success'>-$549.80</div>
</div>
<hr>
<div class='row'>
<div class='col-6'><h4 class='text-primary'>Total:</h4></div>
<div class='col-6 text-end'><h4 class='text-primary'>$5,415.53</h4></div>
</div>
</div>
</div>
</div>
</div>
<!-- Payment Terms -->
<div class='row mb-4'>
<div class='col-12'>
<div class='alert alert-info' role='alert'>
<h6 class='alert-heading'>Payment Terms</h6>
<p class='mb-0'>Payment is due within 30 days. Late payments may incur a 1.5% monthly interest charge. Thank you for your business!</p>
</div>
</div>
</div>
<!-- Footer -->
<div class='row border-top pt-3'>
<div class='col-12 text-center text-muted'>
<small>TechStore Inc. | Tax ID: 12-3456789 | All prices in USD</small>
</div>
</div>
</div>
</body>
</html>";
// Render PDF with optimized settings
var pdf = renderer.RenderHtmlAsPdf(bootstrapInvoice);
// Add metadata for document management
pdf.MetaData.Title = "Invoice INV-2024-1089";
pdf.MetaData.Author = "TechStore Inc.";
pdf.MetaData.Subject = "Sales Invoice";
pdf.MetaData.Keywords = "invoice, payment, e-commerce";
// Save the invoice
pdf.SaveAs("invoice-with-bootstrap.pdf");using IronPdf;
// Set license
IronPdf.License.LicenseKey = "License-Key";
var renderer = new ChromePdfRenderer();
// Bootstrap 5 e-commerce invoice example
string bootstrapInvoice = @"
<!DOCTYPE html>
<html lang='en'>
<head>
<meta charset='utf-8'>
<meta name='viewport' content='width=device-width, initial-scale=1'>
<link href='___PROTECTED_URL_138___ rel='stylesheet'>
<style>
@page { margin: 20mm; }
.invoice-header { border-bottom: 3px solid #0d6efd; }
.product-row { border-bottom: 1px solid #dee2e6; }
.total-section { background-color: #f8f9fa; }
</style>
</head>
<body>
<div class='container-fluid p-4'>
<!-- Invoice Header -->
<div class='row invoice-header pb-4 mb-4'>
<div class='col-8'>
<h1 class='display-4 text-primary'>INVOICE</h1>
<p class='text-muted mb-0'>TechStore Inc.</p>
<p class='text-muted mb-0'>123 Commerce Street, Tech City, TC 12345</p>
<p class='text-muted'>Email: sales@techstore.com | Phone: (555) 123-4567</p>
</div>
<div class='col-4 text-end'>
<p class='mb-1'><strong>Invoice #:</strong> INV-2024-1089</p>
<p class='mb-1'><strong>Date:</strong> October 27, 2024</p>
<p class='mb-1'><strong>Due Date:</strong> November 27, 2024</p>
<span class='badge bg-success'>PAID</span>
</div>
</div>
<!-- Bill To Section -->
<div class='row mb-4'>
<div class='col-6'>
<h5 class='text-primary'>Bill To:</h5>
<p class='mb-1'><strong>Acme Corporation</strong></p>
<p class='mb-1'>456 Business Ave</p>
<p class='mb-1'>Enterprise City, EC 67890</p>
<p class='mb-0'>contact@acmecorp.com</p>
</div>
<div class='col-6 text-end'>
<h5 class='text-primary'>Payment Method:</h5>
<p class='mb-1'>Credit Card ending in 4242</p>
<p class='mb-0'>Transaction ID: TXN-9876543210</p>
</div>
</div>
<!-- Products Table -->
<div class='row mb-4'>
<div class='col-12'>
<table class='table'>
<thead class='table-primary'>
<tr>
<th scope='col'>#</th>
<th scope='col'>Product</th>
<th scope='col'>Description</th>
<th scope='col' class='text-center'>Qty</th>
<th scope='col' class='text-end'>Unit Price</th>
<th scope='col' class='text-end'>Amount</th>
</tr>
</thead>
<tbody>
<tr class='product-row'>
<td>1</td>
<td><strong>IronPDF Pro License</strong></td>
<td>Professional developer license with 1 year support</td>
<td class='text-center'>1</td>
<td class='text-end'>$2,999.00</td>
<td class='text-end'><strong>$2,999.00</strong></td>
</tr>
<tr class='product-row'>
<td>2</td>
<td><strong>Priority Support</strong></td>
<td>24/7 priority technical support package</td>
<td class='text-center'>1</td>
<td class='text-end'>$999.00</td>
<td class='text-end'><strong>$999.00</strong></td>
</tr>
<tr class='product-row'>
<td>3</td>
<td><strong>Training Package</strong></td>
<td>On-site developer training (2 days)</td>
<td class='text-center'>1</td>
<td class='text-end'>$1,500.00</td>
<td class='text-end'><strong>$1,500.00</strong></td>
</tr>
</tbody>
</table>
</div>
</div>
<!-- Totals Section -->
<div class='row justify-content-end mb-4'>
<div class='col-md-6'>
<div class='card total-section'>
<div class='card-body'>
<div class='row mb-2'>
<div class='col-6'><strong>Subtotal:</strong></div>
<div class='col-6 text-end'>$5,498.00</div>
</div>
<div class='row mb-2'>
<div class='col-6'><strong>Tax (8.5%):</strong></div>
<div class='col-6 text-end'>$467.33</div>
</div>
<div class='row mb-2'>
<div class='col-6 text-success'><strong>Discount (10%):</strong></div>
<div class='col-6 text-end text-success'>-$549.80</div>
</div>
<hr>
<div class='row'>
<div class='col-6'><h4 class='text-primary'>Total:</h4></div>
<div class='col-6 text-end'><h4 class='text-primary'>$5,415.53</h4></div>
</div>
</div>
</div>
</div>
</div>
<!-- Payment Terms -->
<div class='row mb-4'>
<div class='col-12'>
<div class='alert alert-info' role='alert'>
<h6 class='alert-heading'>Payment Terms</h6>
<p class='mb-0'>Payment is due within 30 days. Late payments may incur a 1.5% monthly interest charge. Thank you for your business!</p>
</div>
</div>
</div>
<!-- Footer -->
<div class='row border-top pt-3'>
<div class='col-12 text-center text-muted'>
<small>TechStore Inc. | Tax ID: 12-3456789 | All prices in USD</small>
</div>
</div>
</div>
</body>
</html>";
// Render PDF with optimized settings
var pdf = renderer.RenderHtmlAsPdf(bootstrapInvoice);
// Add metadata for document management
pdf.MetaData.Title = "Invoice INV-2024-1089";
pdf.MetaData.Author = "TechStore Inc.";
pdf.MetaData.Subject = "Sales Invoice";
pdf.MetaData.Keywords = "invoice, payment, e-commerce";
// Save the invoice
pdf.SaveAs("invoice-with-bootstrap.pdf");Key Bootstrap Features Demonstrated:
- Grid System:
rowandcol-*classes for responsive layout structure - Typography:
display-4,text-muted,h5for hierarchical text styling - Tables:
table,table-primary,table-hoverfor structured data display - Cards:
cardandcard-bodyfor the totals section with background styling - Badges:
badge bg-successfor payment status indicators - Alerts:
alert alert-infofor payment terms notification - Utilities:
text-end,text-center,mb-*,pb-*spacing utilities - Custom Styling: Combined with Bootstrap classes for invoice-specific design
IronPDF's Chromium engine ensures perfect Bootstrap component rendering:
- Grid System:
rowandcol-*classes for responsive layout - Typography:
display-4,text-muted,h5for hierarchical styling - Tables:
table,table-primary,table-hoverfor structured data - Cards:
cardandcard-bodyfor styled sections - Badges:
badge bg-successfor status indicators - Alerts:
alert alert-infofor notifications - Utilities:
text-end,text-center, spacing utilities - Custom Styling: Combined with Bootstrap for invoice design
For web fonts and icons, IronPDF provides full custom typography support. When troubleshooting Bootstrap layouts, refer to Bootstrap Flex CSS troubleshooting. For viewport and zoom settings, proper configuration ensures responsive layouts render correctly.
What Are ComPDFKit's Limitations with Bootstrap?
ComPDFKit's HTML to PDF conversion relies on external API calls rather than embedded rendering. While this approach handles basic Bootstrap styling, it introduces several limitations:
- Network Dependency: Requires HTTP requests to external services
- CSS Framework Support: May not fully support complex Flexbox or CSS Grid layouts
- Rendering Consistency: Results can vary based on API service implementation
- Custom Styling: Limited control over Bootstrap component rendering
- Performance: Network latency adds overhead to document generation
For applications requiring reliable Bootstrap rendering with full control over styling and layout, native Chromium rendering provides superior results. IronPDF's integrated approach eliminates external dependencies while maintaining complete CSS framework compatibility.
How Do I Add Watermarks to PDFs?
Watermarking PDFs helps protect document integrity, assert ownership, and add security. Watermarks can be text, logos, or images appearing in the background or foreground. They deter unauthorized use and distribution while conveying important information about document status or creator identity.
How Do I Add Watermarks with IronPDF?
IronPDF provides straightforward watermark application to PDF documents programmatically. This functionality integrates into the library, allowing developers to apply watermarks using C# code. For background and foreground placement, IronPDF offers flexible positioning options.
using IronPdf;
using IronPdf.Editing;
class Program
{
static void Main()
{
License.LicenseKey = "License-Code";
string watermarkHtml = @"
<img style='width: 500px;' src='C:\Users\Tayyab Ali\Desktop\watermark.png'>
<h1>IronPDF Watermark</h1>";
ChromePdfRenderer renderer = new ChromePdfRenderer();
PdfDocument pdf = renderer.RenderHtmlAsPdf("<h1>It's a PDF with a watermark</h1>");
// Apply watermark with 30 degrees rotation and 50% opacity
pdf.ApplyWatermark(watermarkHtml, rotation: 30, opacity: 50);
pdf.SaveAs("Confidential.pdf");
}
}using IronPdf;
using IronPdf.Editing;
class Program
{
static void Main()
{
License.LicenseKey = "License-Code";
string watermarkHtml = @"
<img style='width: 500px;' src='C:\Users\Tayyab Ali\Desktop\watermark.png'>
<h1>IronPDF Watermark</h1>";
ChromePdfRenderer renderer = new ChromePdfRenderer();
PdfDocument pdf = renderer.RenderHtmlAsPdf("<h1>It's a PDF with a watermark</h1>");
// Apply watermark with 30 degrees rotation and 50% opacity
pdf.ApplyWatermark(watermarkHtml, rotation: 30, opacity: 50);
pdf.SaveAs("Confidential.pdf");
}
}
This example uses ChromePdfRenderer to create a PDF from HTML. The ApplyWatermark method applies a watermark containing an image and heading. Rotation is set to 30 degrees with 50% opacity, ensuring visibility without overpowering content. The resulting PDF saves to the specified path.
What Advanced Watermarking Options Exist?
IronPDF provides complete watermarking capabilities:
- HTML-Based Watermarks: Use full HTML/CSS for complex designs
- Positioning Control: 3x3 grid placement system
- Opacity Settings: Fine-tune transparency levels
- Rotation Options: Apply any angle for diagonal watermarks
- Page Selection: Apply to all pages or specific ranges
- Multiple Watermarks: Layer different watermarks as needed
For advanced techniques, see stamping text and images or adding multiple stamps efficiently. The stamping new content guide demonstrates dynamic watermark generation.
How Do I Add Watermarks with ComPDFKit?
ComPDFKit provides functionality to add watermarks programmatically using the library's methods. This code example demonstrates adding a text watermark:
static private bool AddTextWatermark(CPDFDocument document)
{
CPDFWatermark watermark = document.InitWatermark(C_Watermark_Type.WATERMARK_TYPE_TEXT);
watermark.SetText("test");
watermark.SetFontName("Helvetica");
watermark.SetPages("0-3");
byte[] color = { 255, 0, 0 };
watermark.SetTextRGBColor(color);
watermark.SetScale(2);
watermark.SetRotation(0);
watermark.SetOpacity(120);
watermark.SetVertalign(C_Watermark_Vertalign.WATERMARK_VERTALIGN_CENTER);
watermark.SetHorizalign(C_Watermark_Horizalign.WATERMARK_HORIZALIGN_CENTER);
watermark.SetVertOffset(0);
watermark.SetHorizOffset(0);
watermark.SetFront(true);
watermark.SetFullScreen(true);
watermark.SetVerticalSpacing(10);
watermark.SetHorizontalSpacing(10);
watermark.CreateWatermark();
string path = "AddTextWatermarkTest.pdf";
if (!document.WriteToFilePath(path))
{
return false;
}
Console.WriteLine("Browse the changed file in " + path);
return true;
}
CPDFDocument document = CPDFDocument.InitWithFilePath("SamplePDF.pdf");
if (AddTextWatermark(document))
{
Console.WriteLine("Add text watermark done.");
}
else
{
Console.WriteLine("Add text watermark failed.");
}static private bool AddTextWatermark(CPDFDocument document)
{
CPDFWatermark watermark = document.InitWatermark(C_Watermark_Type.WATERMARK_TYPE_TEXT);
watermark.SetText("test");
watermark.SetFontName("Helvetica");
watermark.SetPages("0-3");
byte[] color = { 255, 0, 0 };
watermark.SetTextRGBColor(color);
watermark.SetScale(2);
watermark.SetRotation(0);
watermark.SetOpacity(120);
watermark.SetVertalign(C_Watermark_Vertalign.WATERMARK_VERTALIGN_CENTER);
watermark.SetHorizalign(C_Watermark_Horizalign.WATERMARK_HORIZALIGN_CENTER);
watermark.SetVertOffset(0);
watermark.SetHorizOffset(0);
watermark.SetFront(true);
watermark.SetFullScreen(true);
watermark.SetVerticalSpacing(10);
watermark.SetHorizontalSpacing(10);
watermark.CreateWatermark();
string path = "AddTextWatermarkTest.pdf";
if (!document.WriteToFilePath(path))
{
return false;
}
Console.WriteLine("Browse the changed file in " + path);
return true;
}
CPDFDocument document = CPDFDocument.InitWithFilePath("SamplePDF.pdf");
if (AddTextWatermark(document))
{
Console.WriteLine("Add text watermark done.");
}
else
{
Console.WriteLine("Add text watermark failed.");
}
This example opens an existing PDF using CPDFDocument. The AddTextWatermark method initializes a text watermark, setting properties like text content, font, color, scale, rotation, opacity, alignment, and spacing. The watermark applies to specified pages and saves to the defined path. Different methods are required for image watermarks, adding complexity to the implementation.
How Do I Create PDF/A Compliant Documents?
PDF/A is a standardized PDF version designed for long-term digital preservation. Ensuring PDF/A conformance guarantees reliable viewing and reproduction in the future. This section explores creating PDF/A compliant documents using both libraries.
How Does IronPDF Create PDF/A Documents?
IronPDF simplifies converting standard PDFs to PDF/A-compliant formats. The library supports various PDF/A standards including PDF/A-1, PDF/A-2, and PDF/A-3. For information on PDF/A milestone updates and PDF/A-3 with ZUGFeRD support, see product announcements.
using IronPdf;
using System;
class Program
{
static void Main()
{
License.LicenseKey = "License-Key";
PdfDocument pdf = PdfDocument.FromFile("Source.pdf");
pdf.SaveAsPdfA("pdfa-compliant.pdf", PdfAVersions.PdfA3);
}
}using IronPdf;
using System;
class Program
{
static void Main()
{
License.LicenseKey = "License-Key";
PdfDocument pdf = PdfDocument.FromFile("Source.pdf");
pdf.SaveAsPdfA("pdfa-compliant.pdf", PdfAVersions.PdfA3);
}
}The process involves:
- Initialize IronPDF: Begin by importing the IronPDF library and setting your license key.
- Load the PDF: Use PdfDocument.FromFile to load your source PDF file.
- Convert and Save: Convert the loaded PDF to PDF/A by specifying the desired PDF/A version and saving the resulting document.
Why Choose PDF/A for Document Archival?
PDF/A offers several advantages for long-term preservation:
- Self-Contained Documents: All fonts and resources embedded
- No External Dependencies: Eliminates reliance on external content
- Standardized Format: ISO-certified for archival purposes
- Metadata Preservation: Maintains document properties
- Visual Reproducibility: Ensures consistent appearance over time
IronPDF also supports PDF/UA format for accessibility requirements, ensuring documents meet Section 508 compliance standards.
How Does ComPDFKit Create PDF/A Documents?
ComPDFKit provides reliable PDF/A conversion through document initialization, output path definition, and conversion method invocation.
static public bool CovertToPDFA1a(CPDFDocument document)
{
string convertToPDFA1aPath = "ConvertToPDFA1aTest.pdf";
if (!document.WritePDFAToFilePath(CPDFType.CPDFTypePDFA1a, convertToPDFA1aPath))
{
return false;
}
Console.WriteLine("Browse the changed file in " + convertToPDFA1aPath);
return true;
}
CPDFDocument document = CPDFDocument.InitWithFilePath("CommonFivePage.pdf");
if (CovertToPDFA1a(document))
{
Console.WriteLine("Convert to PDF/A-1a done.");
}
else
{
Console.WriteLine("Convert to PDF/A-1a failed.");
}static public bool CovertToPDFA1a(CPDFDocument document)
{
string convertToPDFA1aPath = "ConvertToPDFA1aTest.pdf";
if (!document.WritePDFAToFilePath(CPDFType.CPDFTypePDFA1a, convertToPDFA1aPath))
{
return false;
}
Console.WriteLine("Browse the changed file in " + convertToPDFA1aPath);
return true;
}
CPDFDocument document = CPDFDocument.InitWithFilePath("CommonFivePage.pdf");
if (CovertToPDFA1a(document))
{
Console.WriteLine("Convert to PDF/A-1a done.");
}
else
{
Console.WriteLine("Convert to PDF/A-1a failed.");
}The steps include:
- Initialize the Document: Load the PDF document using CPDFDocument.InitWithFilePath.
- Setup the Output Directory: Ensure the output directory exists or create it if necessary.
- Convert to PDF/A: Use WritePDFAToFilePath with the specified PDF/A type to perform the conversion and save the file.
How Do I Add Digital Signatures to PDFs?
Digital signatures verify document authenticity and integrity. This section demonstrates adding digital signatures using both libraries. For complete digital signature implementation, IronPDF provides extensive documentation.
How Do I Sign PDFs with IronPDF?
IronPDF provides simple and effective digital signature application. The library supports X.509 certificates and HSM integration for enterprise security requirements.
using IronPdf;
using IronPdf.Signing;
class Program
{
static void Main(string[] args)
{
var simpleSignature = new PdfSignature("MyCert.p12", "newpassword");
simpleSignature.SignPdfFile("sample.pdf");
}
}using IronPdf;
using IronPdf.Signing;
class Program
{
static void Main(string[] args)
{
var simpleSignature = new PdfSignature("MyCert.p12", "newpassword");
simpleSignature.SignPdfFile("sample.pdf");
}
}The process involves:
- Initialize IronPDF: Import the necessary IronPDF libraries.
- Create a Signature: Initialize a PdfSignature object with the certificate file and password.
- Sign the PDF: Apply the signature to the PDF using SignPdfFile.
What Advanced Signing Options Does IronPDF Provide?
IronPDF offers complete digital signature features:
- Multiple Signature Types: Certificate-based, visual, and form field signatures
- HSM Support: Hardware security module integration
- Timestamp Server: Add trusted timestamps to signatures
- Signature Appearance: Customize visual signature representation
- Validation Support: Verify existing signatures programmatically
- Revision Control: Maintain signature revision history
For troubleshooting signature issues, see the digital signatures troubleshooting guide.
How Do I Sign PDFs with ComPDFKit?
ComPDFKit offers complete digital signature creation with extensive customization options.
private static void CreateDigitalSignature(CPDFDocument document, string certificatePath, string password)
{
Console.WriteLine("--------------------");
Console.WriteLine("Create digital signature.");
CPDFSignatureCertificate certificate = CPDFPKCS12CertHelper.GetCertificateWithPKCS12Path("Certificate.pfx", "ComPDFKit");
CPDFPage page = document.PageAtIndex(0);
CPDFSignatureWidget signatureField = page.CreateWidget(C_WIDGET_TYPE.WIDGET_SIGNATUREFIELDS) as CPDFSignatureWidget;
signatureField.SetRect(new CRect(28, 420, 150, 370));
signatureField.SetWidgetBorderRGBColor(new byte[] { 0, 0, 0 });
signatureField.SetWidgetBgRGBColor(new byte[] { 150, 180, 210 });
signatureField.UpdateAp();
string name = GetGrantorFromDictionary(certificate.SubjectDict) + "\n";
string date = DateTime.Now.ToString("yyyy.MM.dd HH:mm:ss");
string reason = "I am the owner of the document.";
string location = certificate.SubjectDict["C"];
string DN = certificate.Subject;
CPDFSignatureConfig signatureConfig = new CPDFSignatureConfig
{
Text = GetGrantorFromDictionary(certificate.SubjectDict),
Content =
"Name: " + name + "\n" +
"Date: " + date + "\n" +
"Reason: " + reason + " \n" +
"Location: " + location + "\n" +
"DN: " + DN + "\n",
IsContentAlignLeft = false,
IsDrawLogo = true,
LogoBitmap = new Bitmap("Logo.png"),
TextColor = new float[] { 0, 0, 0 },
ContentColor = new float[] { 0, 0, 0 }
};
string filePath = document.FileName + "_Signed.pdf";
signatureField.UpdataApWithSignature(signatureConfig);
if (document.WriteSignatureToFilePath(signatureField,
filePath,
certificatePath, password,
location,
reason, CPDFSignaturePermissions.CPDFSignaturePermissionsNone))
{
Console.WriteLine("File saved in " + filePath);
Console.WriteLine("Create digital signature done.");
}
else
{
Console.WriteLine("Create digital signature failed.");
}
Console.WriteLine("--------------------");
}private static void CreateDigitalSignature(CPDFDocument document, string certificatePath, string password)
{
Console.WriteLine("--------------------");
Console.WriteLine("Create digital signature.");
CPDFSignatureCertificate certificate = CPDFPKCS12CertHelper.GetCertificateWithPKCS12Path("Certificate.pfx", "ComPDFKit");
CPDFPage page = document.PageAtIndex(0);
CPDFSignatureWidget signatureField = page.CreateWidget(C_WIDGET_TYPE.WIDGET_SIGNATUREFIELDS) as CPDFSignatureWidget;
signatureField.SetRect(new CRect(28, 420, 150, 370));
signatureField.SetWidgetBorderRGBColor(new byte[] { 0, 0, 0 });
signatureField.SetWidgetBgRGBColor(new byte[] { 150, 180, 210 });
signatureField.UpdateAp();
string name = GetGrantorFromDictionary(certificate.SubjectDict) + "\n";
string date = DateTime.Now.ToString("yyyy.MM.dd HH:mm:ss");
string reason = "I am the owner of the document.";
string location = certificate.SubjectDict["C"];
string DN = certificate.Subject;
CPDFSignatureConfig signatureConfig = new CPDFSignatureConfig
{
Text = GetGrantorFromDictionary(certificate.SubjectDict),
Content =
"Name: " + name + "\n" +
"Date: " + date + "\n" +
"Reason: " + reason + " \n" +
"Location: " + location + "\n" +
"DN: " + DN + "\n",
IsContentAlignLeft = false,
IsDrawLogo = true,
LogoBitmap = new Bitmap("Logo.png"),
TextColor = new float[] { 0, 0, 0 },
ContentColor = new float[] { 0, 0, 0 }
};
string filePath = document.FileName + "_Signed.pdf";
signatureField.UpdataApWithSignature(signatureConfig);
if (document.WriteSignatureToFilePath(signatureField,
filePath,
certificatePath, password,
location,
reason, CPDFSignaturePermissions.CPDFSignaturePermissionsNone))
{
Console.WriteLine("File saved in " + filePath);
Console.WriteLine("Create digital signature done.");
}
else
{
Console.WriteLine("Create digital signature failed.");
}
Console.WriteLine("--------------------");
}The steps include:
- Initialize the Document and Certificate: Load the PDF document and retrieve the certificate using CPDFPKCS12CertHelper.
- Create and Configure the Signature Field: Add a signature field to the PDF, set its properties, and configure the signature details.
- Apply the Signature: Use WriteSignatureToFilePath to apply the signature and save the signed PDF.
How Do I Extract Text from PDFs?
Extracting text from PDF documents proves crucial for data processing and analysis. This section explains text extraction using both libraries.
How Does IronPDF Extract Text?
IronPDF offers straightforward text extraction from PDF documents. The library provides methods for extracting all text or specific page content. For parsing PDF content, IronPDF supports structured extraction. When accessing PDF DOM objects, developers can retrieve detailed content information.
using IronPdf;
using System.IO;
PdfDocument pdf = PdfDocument.FromFile("PDF File With Text.pdf");
string text = pdf.ExtractAllText();
File.WriteAllText("PDF Text.txt", text);using IronPdf;
using System.IO;
PdfDocument pdf = PdfDocument.FromFile("PDF File With Text.pdf");
string text = pdf.ExtractAllText();
File.WriteAllText("PDF Text.txt", text);The process involves:
- Initialize IronPDF: Import the IronPDF library.
- Load the PDF: Use PdfDocument.FromFile to load the PDF file.
- Extract Text: Call ExtractAllText to retrieve all text content from the PDF.
- Save Text to File: Write the extracted text to a file using standard file I/O operations.
What Advanced Text Extraction Features Are Available?
IronPDF provides sophisticated text extraction capabilities:
- Page-Specific Extraction: Extract text from individual pages
- Structured Content: Access text with formatting information
- Search and Replace: Find and replace text within PDFs
- Regular Expression Support: Pattern-based text extraction
- Coordinate-Based Extraction: Extract text from specific regions
- Language Support: Handle UTF-8 and international characters
For complete text reading examples, see the reading PDF text guide.
How Does ComPDFKit Extract Text?
ComPDFKit provides flexible text extraction from PDF documents.
static private bool PDFToText(CPDFDocument document)
{
string path = "//PDFToText.txt";
if (!document.PdfToText("1-" + document.PageCount.ToString(), path))//Page ranges are counted from 1
{
return false;
}
Console.WriteLine("Browse the generated file in " + path);
return true;
}
static void Main(string[] args)
{
Console.WriteLine("Running PDFPage test sample…\r\n");
SDKLicenseHelper.LicenseVerify();
CPDFDocument document = CPDFDocument.InitWithFilePath("CommonFivePage.pdf");
if (PDFToText(document))
{
Console.WriteLine("PDF to text done.");
}
else
{
Console.WriteLine("PDF to text failed.");
}
Console.WriteLine("--------------------");
Console.WriteLine("Done!");
Console.WriteLine("--------------------");
Console.ReadLine();
}static private bool PDFToText(CPDFDocument document)
{
string path = "//PDFToText.txt";
if (!document.PdfToText("1-" + document.PageCount.ToString(), path))//Page ranges are counted from 1
{
return false;
}
Console.WriteLine("Browse the generated file in " + path);
return true;
}
static void Main(string[] args)
{
Console.WriteLine("Running PDFPage test sample…\r\n");
SDKLicenseHelper.LicenseVerify();
CPDFDocument document = CPDFDocument.InitWithFilePath("CommonFivePage.pdf");
if (PDFToText(document))
{
Console.WriteLine("PDF to text done.");
}
else
{
Console.WriteLine("PDF to text failed.");
}
Console.WriteLine("--------------------");
Console.WriteLine("Done!");
Console.WriteLine("--------------------");
Console.ReadLine();
}The steps are:
- Initialize the Document: Load the PDF document using CPDFDocument.InitWithFilePath.
- Extract and Save Text: Use PdfToText to extract text from the specified page range and save it to a file.
Real-World Use Case Scenarios
Understanding when to use each library helps developers make informed decisions based on project requirements. These scenarios illustrate practical applications where each library excels.
When Should I Choose IronPDF?
Enterprise Document Generation System A financial services company needs to generate 50,000+ monthly statements with complex layouts, charts, and regulatory compliance requirements.
IronPDF advantages:
- Performance: Async/multithreading support handles high volume efficiently
- Compliance: Built-in PDF/A and PDF/UA for regulatory requirements
- Charts: Native JavaScript chart rendering for financial visualizations
- Security: Advanced encryption for sensitive data
- Support: 24/5 engineering support for production issues
SaaS Invoice Generation Platform A multi-tenant SaaS platform generating branded invoices for thousands of customers with custom templates.
IronPDF advantages:
- HTML/CSS Support: Full Bootstrap compatibility for branded templates
- Performance: Docker deployment for scalable architecture
- Customization: Headers/footers and watermarks for branding
- API Design: Simple API reduces development time
- Cloud Ready: Native Azure and AWS support
When Should I Consider ComPDFKit?
Basic PDF Viewer Application A desktop application requiring PDF viewing and basic annotation features without HTML conversion needs.
ComPDFKit advantages:
- Viewer Component: Built-in viewing functionality
- Annotation Tools: Native annotation support
- Simple Integration: Direct PDF manipulation without HTML
- Offline Operation: No network dependencies for core features
Document Archive System An internal document management system focused on PDF organization and basic editing.
ComPDFKit advantages:
- File Manipulation: Strong PDF merge/split capabilities
- Basic Editing: Text and image modification tools
- Traditional Approach: Familiar PDF-centric API design
What Are the Licensing Options?
The licensing models for IronPDF and ComPDFKit differ in approach and usage terms. Understanding these differences helps developers choose the right tool for project needs and budget.
What Licensing Options Does IronPDF Offer?

IronPDF operates under a transparent commercial licensing model:
License Types:
- Lite License ($749): 1 developer, 1 location, 1 project
- Plus License ($1,499): 3 developers, 3 locations, 3 projects
- Professional License ($2,999): 10 developers, 10 locations, 10 projects
- Enterprise/OEM: Custom pricing for unlimited deployment
Key Benefits:
- Perpetual Licensing: One-time payment for lifetime use
- Royalty-Free Distribution: No runtime fees
- Source Code Available: Optional purchase for security audits
- Flexible Upgrades: Licensing extensions and upgrades available
- Trial Period: Free trial license for evaluation
IronPDF's commercial model ensures enterprises receive dedicated support, complete documentation, and advanced features for professional PDF generation and manipulation. The transparent pricing structure eliminates hidden costs and provides budget predictability.
What Licensing Options Does ComPDFKit Offer?
ComPDFKit employs flexible licensing catering to different business needs:
License Options:
- Perpetual License: One-time payment for lifetime SDK access
- Subscription License: Regular payments with ongoing updates
- Quote-Based Pricing: Custom pricing per project requirements
Considerations:
- Variable Costs: Pricing requires direct contact for quotes
- Update Fees: Optional fees for version updates
- Support Packages: Separate support agreement requirements
- API Usage Limits: Additional costs for HTML conversion API
What Documentation and Support Is Available?
What Support Does IronPDF Provide?
IronPDF offers documentation and support infrastructure:
Documentation Resources:
- Complete Guides: 500+ code examples covering all features
- API Reference: Complete API documentation with
IntelliSensesupport - Tutorials: Step-by-step tutorials for common scenarios
- Troubleshooting: Extensive troubleshooting guides for known issues
- Platform Guides: Specific guides for Windows, Linux, macOS, Azure, and Docker
Support Channels:
- 24/5 Engineering Support: Direct access to development team
- Response Time: Priority support with guaranteed response times
- Code Review: Engineering team reviews complex implementations
- Custom Solutions: Assistance with unique requirements
- Regular Updates: Product updates and milestone features
For making engineering support requests, detailed guidelines ensure efficient resolution. The support infrastructure includes deployment assistance for various platforms.
What Support Does ComPDFKit Provide?
ComPDFKit provides basic documentation and support resources:
Documentation:
- Getting Started Guide: Basic setup instructions
- API Reference: Standard method documentation
- Sample Code: Limited examples for core features
- Platform Documentation: Basic platform integration guides
Support Options:
- Email Support: Standard business hours response
- Technical Assistance: Basic troubleshooting help
- Community Forum: User-driven support community
While both libraries offer documentation and support, IronPDF provides significantly more complete resources, faster response times, and direct engineering support critical for production deployments.
Performance and Optimization Considerations
Performance impacts production system viability. Understanding each library's optimization capabilities helps architects design efficient solutions.
How Does IronPDF Optimize Performance?
IronPDF provides extensive performance optimization features:
Architectural Advantages:
- Native Chrome Engine: Optimized C++ rendering engine
- Memory Management: Efficient handling of large documents
- Thread Safety: Built for concurrent web applications
- Resource Pooling: Reusable rendering instances
Performance Features:
- Async Operations: Non-blocking PDF generation
- Multithreading Support: Parallel document processing
- Linearization: Fast web view optimization
- Compression: Reduce file sizes up to 90%
- Memory Stream Processing: Avoid disk I/O overhead
Benchmarks (50-page document generation):
- Single-threaded: 2.3 seconds average
- Multi-threaded (8 cores): 0.4 seconds per document
- Memory usage: 180MB peak
- Concurrent requests: 100+ simultaneous renders
What Are ComPDFKit's Performance Characteristics?
ComPDFKit provides standard performance for basic operations:
Performance Profile:
- Synchronous Processing: Traditional blocking operations
- Memory Usage: Higher consumption for complex documents
- Concurrency: Limited simultaneous operation support
- HTML Conversion: Network latency adds 1-3 seconds
Limitations:
- No built-in async support
- Limited threading documentation
- API calls introduce network overhead
- Resource management requires manual implementation
Enterprise Integration Patterns
Production systems require specific architectural patterns for reliability and scalability. Understanding integration approaches helps teams implement reliable solutions.
How to Implement IronPDF in Microservices?
IronPDF supports modern architectural patterns:
Containerized PDF Service:
// Dockerfile for IronPDF microservice
FROM mcr.microsoft.com/dotnet/aspnet:6.0
RUN apt-get update && apt-get install -y \
libgdiplus \
libc6-dev \
libx11-6
COPY . /app
WORKDIR /app
ENTRYPOINT ["dotnet", "PdfService.dll"]// Dockerfile for IronPDF microservice
FROM mcr.microsoft.com/dotnet/aspnet:6.0
RUN apt-get update && apt-get install -y \
libgdiplus \
libc6-dev \
libx11-6
COPY . /app
WORKDIR /app
ENTRYPOINT ["dotnet", "PdfService.dll"]Scalable API Implementation:
[ApiController]
[Route("api/[controller]")]
public class PdfController : ControllerBase
{
private readonly ChromePdfRenderer _renderer;
public PdfController()
{
_renderer = new ChromePdfRenderer();
// Configure for production
_renderer.RenderingOptions.EnableJavaScript = true;
_renderer.RenderingOptions.RenderDelay = 500;
}
[HttpPost("generate")]
public async Task<IActionResult> GeneratePdf([FromBody] PdfRequest request)
{
try
{
var pdf = await _renderer.RenderHtmlAsPdfAsync(request.Html);
// Apply security if needed
if (request.RequirePassword)
{
pdf.SecuritySettings.SetPassword(request.Password);
}
var stream = pdf.Stream;
return File(stream, "application/pdf", request.FileName);
}
catch (Exception ex)
{
// Complete error handling
return StatusCode(500, new { error = ex.Message });
}
}
}[ApiController]
[Route("api/[controller]")]
public class PdfController : ControllerBase
{
private readonly ChromePdfRenderer _renderer;
public PdfController()
{
_renderer = new ChromePdfRenderer();
// Configure for production
_renderer.RenderingOptions.EnableJavaScript = true;
_renderer.RenderingOptions.RenderDelay = 500;
}
[HttpPost("generate")]
public async Task<IActionResult> GeneratePdf([FromBody] PdfRequest request)
{
try
{
var pdf = await _renderer.RenderHtmlAsPdfAsync(request.Html);
// Apply security if needed
if (request.RequirePassword)
{
pdf.SecuritySettings.SetPassword(request.Password);
}
var stream = pdf.Stream;
return File(stream, "application/pdf", request.FileName);
}
catch (Exception ex)
{
// Complete error handling
return StatusCode(500, new { error = ex.Message });
}
}
}Benefits:
- Horizontal Scaling: Add instances as needed
- Fault Isolation: Service failures don't impact system
- Resource Control: Container limits prevent resource exhaustion
- Deployment Flexibility: Works with Kubernetes, Docker Swarm
What About ComPDFKit Enterprise Integration?
ComPDFKit requires traditional integration approaches:
- Monolithic Design: Library tightly coupled with application
- Limited Scaling: Vertical scaling only
- Resource Sharing: Potential conflicts in multi-tenant scenarios
- API Dependencies: External service requirements complicate architecture
Security and Compliance Features
Enterprise applications demand reliable security features for regulatory compliance and data protection.
How Does IronPDF Handle Security?
IronPDF provides complete security features:
Encryption Options:
- AES 256-bit Encryption: Military-grade security
- User/Owner Passwords: Separate access levels
- Permission Controls: Granular action restrictions
- Digital Signatures: Certificate-based authentication
- HSM Support: Hardware security module integration
Compliance Features:
- PDF/A Standards: Long-term archival compliance
- PDF/UA Support: Accessibility standards
- Sanitization: Remove malicious content
- Redaction: Permanent content removal
- Audit Trail: Document revision history
Implementation Example:
// Secure document generation
var pdf = renderer.RenderHtmlAsPdf(htmlContent);
// Apply complete security
pdf.SecuritySettings.SetPassword("user123");
pdf.SecuritySettings.SetOwnerPassword("owner456");
pdf.SecuritySettings.MakePdfDocumentReadOnly();
pdf.SecuritySettings.SetPdfSecuritySettings(
canPrint: true,
canCopy: false,
canModify: false
);
// Add digital signature
var signature = new PdfSignature("cert.pfx", "password");
pdf.SignWithSignature(signature);
// Ensure compliance
pdf.SaveAsPdfA("secure-compliant.pdf", PdfAVersions.PdfA3);// Secure document generation
var pdf = renderer.RenderHtmlAsPdf(htmlContent);
// Apply complete security
pdf.SecuritySettings.SetPassword("user123");
pdf.SecuritySettings.SetOwnerPassword("owner456");
pdf.SecuritySettings.MakePdfDocumentReadOnly();
pdf.SecuritySettings.SetPdfSecuritySettings(
canPrint: true,
canCopy: false,
canModify: false
);
// Add digital signature
var signature = new PdfSignature("cert.pfx", "password");
pdf.SignWithSignature(signature);
// Ensure compliance
pdf.SaveAsPdfA("secure-compliant.pdf", PdfAVersions.PdfA3);What Security Does ComPDFKit Provide?
ComPDFKit offers basic security features:
- Password Protection: Basic user/owner passwords
- Encryption: Standard PDF encryption
- Permissions: Limited permission settings
- Digital Signatures: Certificate-based signing
However, advanced features like HSM support, sanitization, and complete compliance tools require additional implementation.
Which PDF Library Should I Choose?
The comparison between IronPDF and ComPDFKit reveals clear distinctions for different use cases and requirements.
Why IronPDF Excels for Enterprise Applications
IronPDF stands out as the superior choice for production systems requiring:
Technical Excellence:
- Native HTML Rendering: Chromium engine ensures perfect conversion
- Performance: Async/multithreading for high-volume processing
- Reliability: Thread-safe architecture for web applications
- Integration: Simple API reduces development time
Business Value:
- Total Cost of Ownership: Transparent pricing without hidden fees
- Support Infrastructure: 24/5 engineering support minimizes downtime
- Documentation: 500+ examples accelerate development
- Future-Proofing: Regular updates and new features
Real Developer Feedback: "IronPDF transformed the invoice generation system. Developers process 100,000+ documents monthly with zero rendering issues. The Bootstrap support saved weeks of development time." - Senior .NET Architect, Fortune 500 Retailer
"After evaluating multiple libraries, IronPDF's performance and support made it the clear choice. The async capabilities reduced the processing time by 75%." - Technical Lead, Financial Services
When ComPDFKit Might Suffice
ComPDFKit may be adequate for:
- Simple PDF Viewing: Basic desktop applications
- Limited Scope: Projects without HTML conversion needs
- Budget Constraints: When external API costs are acceptable
- Basic Operations: Simple merge/split requirements
Final Recommendation
For senior .NET developers building production systems with performance, reliability, and architectural pattern priorities, IronPDF provides the complete solution. Its combination of technical capabilities, enterprise features, and superior support infrastructure ensures successful project delivery.
Key Decision Factors:
| Requirement | IronPDF | ComPDFKit | Winner |
|---|---|---|---|
| HTML to PDF | Native Chromium | External API | IronPDF |
| Performance | Async/Multithreaded | Synchronous | IronPDF |
| CSS Support | Full Bootstrap/Flexbox | Limited | IronPDF |
| Documentation | 500+ Examples | Basic | IronPDF |
| Support | 24/5 Engineering | Email Only | IronPDF |
| Enterprise Features | Complete | Limited | IronPDF |
| Total Cost | Transparent | Variable | IronPDF |
IronPDF provides a free trial license for testing the library and its capabilities. IronPDF licenses start from $749. Additionally, Iron Software bundles nine libraries for the cost of two, including IronXL and IronOCR along with IronPDF.
For teams requiring professional PDF generation with enterprise support, IronPDF delivers the complete solution. Its proven track record with Fortune 500 companies, complete feature set, and dedication to developer success make it the improve choice for serious .NET applications.
Frequently Asked Questions
How can I convert HTML to PDF in C#?
You can use IronPDF's RenderHtmlAsPdf method to convert HTML strings into PDFs. This method is suitable for converting HTML, CSS, and JavaScript into high-quality PDF documents.
What are the benefits of using a C# PDF library?
C# PDF libraries like IronPDF and ComPDFKit enable PDF creation, modification, and text/image extraction. They support features such as form handling, digital signatures, and security, providing flexibility across different platforms.
Can I add security to my PDFs in C#?
Yes, using IronPDF, you can enhance PDF security by setting passwords, encrypting documents, and adding digital signatures to protect sensitive information.
How does ComPDFKit handle PDF editing and conversion?
ComPDFKit offers robust PDF editing capabilities and conversion to various formats, including PDF/A for long-term digital preservation, making it versatile for cross-platform projects.
What licensing options are available for C# PDF libraries?
IronPDF offers a commercial licensing model with perpetual licenses, while ComPDFKit provides both perpetual and subscription licenses, allowing flexibility based on business needs.
What support and resources are available for developers using these libraries?
IronPDF provides comprehensive documentation and responsive customer support, making it suitable for enterprise-level applications. ComPDFKit also offers thorough documentation and technical support.
How do IronPDF and ComPDFKit compare in terms of HTML to PDF conversion?
IronPDF excels in HTML to PDF conversion, supporting HTML strings, URLs, ASPX web forms, and MVC views, whereas ComPDFKit offers a broader range of PDF editing and conversion features.








