Getting Started
DroidPDF is a Kotlin-native PDF library for Android. Add it to your project and start creating, editing, and manipulating PDF documents in minutes.
Installation
Gradle (Kotlin DSL)
Add DroidPDF to your module's build.gradle.kts:
dependencies {
implementation("com.droidpdf:droidpdf:1.0.0")
}
Gradle (Groovy)
dependencies {
implementation 'com.droidpdf:droidpdf:1.0.0'
}
Repository
Make sure you have Maven Central or JitPack in your project's settings.gradle.kts:
dependencyResolutionManagement {
repositories {
mavenCentral()
}
}
Requirements
| Requirement | Minimum |
|---|---|
| Android API | 26 (Android 8.0) |
| Kotlin | 2.1+ |
| JVM Target | 17 |
License Setup (Commercial Use)
DroidPDF is free for personal and non-commercial use. For commercial apps, purchase a license and initialize with your key:
// In your Application.onCreate() or Activity
DroidPDF.initialize(context, licenseKey = "YOUR-LICENSE-KEY")
Note: DroidPDF works without a license key. A warning log is shown once per session. Commercial use without a license key violates the license terms.
Quick Example
Create a simple PDF with text and a table:
val outputStream = FileOutputStream(File(cacheDir, "output.pdf"))
val pdf = PdfDocument(outputStream)
val document = Document(pdf)
// Add a title
document.add(
Paragraph("Invoice #1234")
.setFont(PdfFont.helveticaBold())
.setFontSize(24f)
)
// Add a table
document.add(
Table(3).apply {
addCell("Item")
addCell("Qty")
addCell("Price")
addCell("Widget")
addCell("10")
addCell("$9.99")
}
)
document.close()
What's Next
- PDF Generation — Text, images, fonts, and page sizes
- Page Operations — Merge, split, rotate PDFs
- Annotations — Highlights, stamps, shapes, links
- Forms — Text fields, checkboxes, dropdowns
- Encryption — Password protection and permissions