Guide
If you are interested in all the functions mentioned in the overview section, please read our guide carefully to quickly add PDF generation functionality to your project. The following sections list some examples showing how to use our C# API to use PDF generation functions in .NET projects. If you follow our provided guides and examples, you will be able to quickly integrate PDF generation functionality into your .NET project using our C# API.
Overview
Using the ComPDF Generation .NET Core library, you can achieve fast and bulk PDF generation in your application. We provide different methods for PDF generation, and you can choose the one that best fits your business scenario.
Generating PDF from HTML templates: Simply create an HTML template once, and then use JSON data to populate the template for bulk generation of different PDFs while retaining the original page layout. This method supports inserting text, images, and dynamic tables, making it ideal for generating complex and elegant PDFs, such as reports, invoices, letters, and contracts.
Converting HTML to PDF: Standard HTML files or HTML strings can be converted into PDF files, suitable for quickly converting existing HTML content to PDF documents.
Generating PDF through Layout API: Directly create and control every element of PDF documents through code, providing the finest level of control. This method allows you to completely build PDF documents from scratch programmatically, making it ideal for scenarios that require precise control of document layout, dynamic generation of complex structured documents, or deep integration with existing code logic. The Layout API supports a rich set of element types (text, paragraphs, tables, lists, images, etc.) and provides a complete style system and flexible layout control.
Main Capabilities of HTML PDF Generation:
- Fast speed, capable of meeting the demand for bulk PDF generation.
- Perfectly restores template layout.
- Rich support for HTML tags and CSS styles.
- Supports text reflow, maintaining a perfect page layout.
- Supports dynamic tables.
Main Capabilities of Layout API PDF Generation:
- Complete Programmatic Control: Precisely control the position, size, and style of each element in the document.
- Rich Element Types: Supports text, paragraphs, tables, lists, images, separators, and various other elements.
- Flexible Layout System: Supports block-level elements, inline elements, and absolute positioning.
- Complete Style System: Supports reusable styles, box model, background, fonts, etc.
- Flowing Layout: Automatically handles pagination and content reflow, supports table headers and footers repeating across multiple pages.
- Tree-Structured Document: Adopts an intuitive hierarchical structure to organize document content.
Start your experience now!