Skip to content
ComPDF

Guides

If you're interested in the features mentioned in Overview section, please go through our guides to quickly add PDF generation to your application. The following sections list some examples to show you how to add PDF generation functionalities to Java apps using the APIs of PDF generation SDK for Java.

Overview

Using the PDF Generation Java 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.

  1. 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.
  2. 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.
  3. 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:

  1. Fast speed, capable of meeting the demand for bulk PDF generation.
  2. Perfectly restores template layout.
  3. Rich support for HTML tags and CSS styles.
  4. Supports text reflow, maintaining a perfect page layout.
  5. Supports dynamic tables.

Main Capabilities of Layout API PDF Generation:

  1. Complete Programmatic Control: Precisely control the position, size, and style of each element in the document.
  2. Rich Element Types: Supports text, paragraphs, tables, lists, images, separators, and various other elements.
  3. Flexible Layout System: Supports block-level elements, inline elements, and absolute positioning.
  4. Complete Style System: Supports reusable styles, box model, background, fonts, etc.
  5. Flowing Layout: Automatically handles pagination and content reflow, supports table headers and footers repeating across multiple pages.
  6. Tree-Structured Document: Adopts an intuitive hierarchical structure to organize document content.

Start your experience now!