Download our ready-to-use Java code samples for document processing, editing, extraction, and conversion tasks. Each sample includes complete source code and shows how to implement common document workflows in your applications.

Document Editor samples

Modify PDF documents by adding pages, editing metadata, and combining files programmatically.

Add a custom page to a PDF

Add custom pages with specific dimensions to existing PDF documents. This is useful for inserting signature pages, cover pages, or blank pages for notes.

Download sample.

Edit PDF metadata

Modify document properties like title, author, subject, and keywords.

Download sample.

Merge a PDF into another PDF

Combine multiple PDF documents into a single file.

Download sample.

Data extraction samples

Extract text and structured data from images using OCR and ICR technologies.

Extract data from images using ICR

Extract structured data from images using intelligent content recognition (ICR). This uses local AI models for offline document understanding and detecting tables, equations, and semantic elements without external API calls.

Download sample.

Extract data from images using OCR

Extract text from images using optical character recognition (OCR). This is optimized for speed and high-throughput scenarios with fast text extraction and minimal overhead.

Download sample.

Document conversion samples

Convert documents between PDF, Office formats, and HTML with full formatting preservation.

Word document to PDF

Convert Microsoft Word documents (.docx) to PDF format.

Download sample.

Word document to PDF/UA

Convert Word documents to PDF/UA (universal accessibility)-compliant format. This is useful for legal documents, government forms, and accessibility compliance.

Download sample.

Excel document to PDF

Convert Microsoft Excel spreadsheets to PDF format.

Download sample.

PowerPoint document to PDF

Convert Microsoft PowerPoint presentations to PDF format.

Download sample.

PDF to Word document

Convert PDF files back to editable Microsoft Word documents.

Download sample.

PDF to Excel document

Extract and convert PDF content to Microsoft Excel format.

Download sample.

PDF to PowerPoint document

Convert PDF files to Microsoft PowerPoint presentations.

Download sample.

PDF to HTML

Convert PDF documents to HTML format for web display.

Download sample.

Template processing samples

Generate documents from templates with dynamic content substitution.

Word template generation

Generate documents from Word templates with dynamic content. This is useful for creating contracts, reports, and personalized documents.

Download sample.

Word template to PDF/UA

Convert Word templates to PDF/UA-compliant documents. This is useful for accessible template-based document generation.

Download sample.

Getting started

Each sample includes:

  • Complete Java source code with detailed comments
  • Maven build configurations
  • Sample input files for testing
  • README with setup instructions

To use these samples:

  1. Download and extract the ZIP file to your development directory
  2. Import the project into your Java IDE:
    • IntelliJ IDEA — File → Open → Select the project folder
    • Eclipse — File → Import → Existing Maven Project
  3. Install dependencies
  4. Run the main class to see the sample in action
  5. Modify the code for your specific use case

What’s next

After exploring these samples: