Skip to content
DemoSampleAPI ReferenceFAQ

PDF Generation Template Editor

Open-source visual PDF generation engine with customizable templates and developer-friendly APIs.

View on GitHub

Overview ​

ComPDF Generation for Java is a powerful PDF generation library that provides multiple ways to generate high-quality PDF documents. Whether through HTML conversion or direct code construction, it can meet your various PDF generation needs.

ComPDF Generation SDK ​

ComPDF Generation for Java supports Linux.

Key Features ​

PDF Generation component offers the following features:

Generate PDF from HTML ​

  • HTML to PDF: Supports converting HTML strings, files, or streams into PDF documents.
  • Template Rendering: Supports dynamically filling HTML templates using JSON data and rendering them into PDF documents.
  • Custom Configuration: Configure page size, page margins, base URI, fonts, and header/footer templates.
  • Font Management: Supports custom fonts and can integrate system fonts.

Generate PDF Using Layout API ​

  • Programmatic Document Construction: Directly create and control every element of PDF documents through code.
  • Rich Element Types: Supports text, paragraphs, tables, lists, images, separators, and various other elements.
  • Flexible Layout Control: Supports block-level elements, inline elements, and absolute positioning, providing precise layout control.
  • Complete Style System: Supports reusable styles, box model (margin, padding, border), 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, easy to understand and maintain.

The Layout API is particularly suitable for scenarios that require precise control of document layout, dynamic generation of complex structured documents, or deep integration with existing code logic.

Convert Email to HTML and PDF ​

  • EML and MSG Input: Convert email files, byte arrays or streams to HTML or PDF.
  • HTML Package and Attachments: Export the selected email body with its resources and available attachments.
  • Conversion Control: Inspect status, diagnostics and body provenance; configure byte budgets and cooperative cancellation.