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

1. Add JitPack repository

In your project's settings.gradle.kts:

dependencyResolutionManagement {
    repositories {
        google()
        mavenCentral()
        maven { url = uri("https://jitpack.io") }
    }
}

2. Add the dependency

In your module's build.gradle.kts:

dependencies {
    implementation("com.github.youichi-uda:droidpdf:v1.0.0")
}

Groovy

// settings.gradle
maven { url 'https://jitpack.io' }

// build.gradle
implementation 'com.github.youichi-uda:droidpdf:v1.0.0'

Requirements

RequirementMinimum
Android API26 (Android 8.0)
Kotlin2.1+
JVM Target17

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