PDF Document API for Java
- 3 minutes to read
The PDF Document API is a cross-platform Java library that allows you to create, load, modify, convert, and secure PDF documents programmatically.
The API exposes a document object model (DOM) that allows you to inspect and modify document structures such as pages, content fragments, annotations, form fields, and logical structure elements.
- Simplified object model
PdfDocument └─ Page ├─ TextFragment ├─ ImageFragment ├─ Annotation └─ FormField- Content object model
- Create content objects such as TextFragment or ImageFragment and configure their properties. You can create, inspect, modify, reorder, or remove these elements.
- True cross-platform support
- Runs on Windows, Linux, and macOS without platform-specific dependencies.
- Tagged PDF documents
- Create and edit tagged PDF documents that include a logical structure tree. Tagged PDF documents improve accessibility and help you create PDF/UA-compliant documents.
Get Started
Follow the step-by-step tutorial to learn the basic workflow and understand the fundamental API patterns.
Features
- Create PDF Documents
Create PDF documents from scratch. Add text, images, vector graphics, and reusable templates to build document layouts.
- Manage PDF Documents
Load existing PDF documents, merge multiple files, transform page content, search and replace text, attach files, and save document changes.
- Manage Pages
Insert, remove, reorder, resize, and rotate pages to organize document layout.
- Export PDF Pages to Images
Render PDF pages as image files for preview, printing, or integration with other applications.
- Bookmarks
Create bookmark hierarchies, customize bookmark appearance, and associate bookmarks with destinations or actions.
- Interactive Forms (AcroForms)
Create interactive PDF forms, access and modify form fields, format field values, organize form fields, and import or export form data.
- Annotations
Add, edit, and remove PDF annotations. The API supports markup, text markup, drawing, document navigation, file and multimedia, watermark, printer mark, and trap network annotations.
- Accessibility and Compliance
Generate tagged PDF documents for accessible content and create ZUGFeRD-compliant PDF invoices.
- Secure PDF Documents
Protect PDF documents with encryption, passwords, and access permissions.
- Document Metadata
Read, create, and modify PDF document metadata, including document information and XMP metadata.
Demos
Explore Office & PDF File API demos in the following GitHub repository. Each project is a standalone Java application that demonstrates a specific API feature and can serve as a starting point for your own projects.