Picture of document with grid background overlaid by note UI, vertical annotation toolbar, and image

Android PDF SDK Extend Your Android App with 30+ Features

All engineered for the best possible user and developer experience.

Relied upon by industry leaders
A Great User Experience

Easy to Use.
Easy to Change.

Try PDF Viewer, our free demo app
Get on Google Play

Easy Integration

Examples
Basic Example
Kotlin
Java
1
2
3
val uri = Uri.parse("file:///android_asset/my-document.pdf")
val config = PdfActivityConfiguration.Builder(context).build()
PdfActivity.showDocument(this, uri, config)
1
2
3
final Uri uri = Uri.parse("file:///android_asset/my-document.pdf");
final PdfActivityConfiguration config = new PdfActivityConfiguration.Builder(context).build();
PdfActivity.showDocument(this, uri, config);
Custom Toolbar
Kotlin
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    setOnContextualToolbarLifecycleListener(this)
}

override fun onPrepareContextualToolbar(toolbar: ContextualToolbar<*>) {
    if (toolbar is AnnotationCreationToolbar) {
        // Get the existing menu items so we can modify them.
        val menuItems = toolbar.menuItems

        // Find and remove the ink highlighter button from the toolbar.
        val highlighterItem = menuItems.find { it.id ==  R.id.pspdf__annotation_creation_toolbar_item_ink_highlighter}
        if (highlighterItem != null) {
            menuItems.remove(highlighterItem)
        }

        // Replace the menu items.
        toolbar.setMenuItems(menuItems)
    }
}

override fun onDisplayContextualToolbar(toolbar: ContextualToolbar<*>) {}
override fun onRemoveContextualToolbar(toolbar: ContextualToolbar<*>) {}
Create Annotation
Kotlin
Java
1
2
3
4
5
6
7
8
// Create the text on the first page.
val freeTextAnnotation = FreeTextAnnotation(0, RectF(100f, 100f, 300f, 140f), "My Annotation")
// Set the text color.
freeTextAnnotation.color = Color.RED
// Set the text size.
freeTextAnnotation.textSize = 20f
// Add it to the page.
pdfFragment?.addAnnotationToPage(freeTextAnnotation, false)
1
2
3
4
5
6
7
8
// Create the text on the first page.
final FreeTextAnnotation freeTextAnnotation = new FreeTextAnnotation(0, new RectF(100, 100, 300, 140), "My Annotation");
// Set the text color.
freeTextAnnotation.setColor(Color.RED);
// Set the text size.
freeTextAnnotation.setTextSize(20f);
// Add it to the page.
getPdfFragment().addAnnotationToPage(freeTextAnnotation, false);
Kotlin
Java
1
2
3
val uri = Uri.parse("file:///android_asset/my-document.pdf")
val config = PdfActivityConfiguration.Builder(context).build()
PdfActivity.showDocument(this, uri, config)
1
2
3
final Uri uri = Uri.parse("file:///android_asset/my-document.pdf");
final PdfActivityConfiguration config = new PdfActivityConfiguration.Builder(context).build();
PdfActivity.showDocument(this, uri, config);
Kotlin
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    setOnContextualToolbarLifecycleListener(this)
}

override fun onPrepareContextualToolbar(toolbar: ContextualToolbar<*>) {
    if (toolbar is AnnotationCreationToolbar) {
        // Get the existing menu items so we can modify them.
        val menuItems = toolbar.menuItems

        // Find and remove the ink highlighter button from the toolbar.
        val highlighterItem = menuItems.find { it.id ==  R.id.pspdf__annotation_creation_toolbar_item_ink_highlighter}
        if (highlighterItem != null) {
            menuItems.remove(highlighterItem)
        }

        // Replace the menu items.
        toolbar.setMenuItems(menuItems)
    }
}

override fun onDisplayContextualToolbar(toolbar: ContextualToolbar<*>) {}
override fun onRemoveContextualToolbar(toolbar: ContextualToolbar<*>) {}
Kotlin
Java
1
2
3
4
5
6
7
8
// Create the text on the first page.
val freeTextAnnotation = FreeTextAnnotation(0, RectF(100f, 100f, 300f, 140f), "My Annotation")
// Set the text color.
freeTextAnnotation.color = Color.RED
// Set the text size.
freeTextAnnotation.textSize = 20f
// Add it to the page.
pdfFragment?.addAnnotationToPage(freeTextAnnotation, false)
1
2
3
4
5
6
7
8
// Create the text on the first page.
final FreeTextAnnotation freeTextAnnotation = new FreeTextAnnotation(0, new RectF(100, 100, 300, 140), "My Annotation");
// Set the text color.
freeTextAnnotation.setColor(Color.RED);
// Set the text size.
freeTextAnnotation.setTextSize(20f);
// Add it to the page.
getPdfFragment().addAnnotationToPage(freeTextAnnotation, false);

Compatibility

For cross-platform development, including support for building Android apps, we also offer SDKs for React Native, Flutter, Ionic, Xamarin, and Cordova.

React Native Flutter Ionic Microsoft Xamarin Apache Cordova / PhoneGap

Knowledge Base

Guides

Explore our comprehensive documentation and guides.

Examples Catalog

Clone our public examples catalog from GitHub.

Blog

Come read more about what goes on inside PSPDFKit.

Free 60 Day Trial Try PSPDFKit in your app today.
Free Trial
Showcase

Apps Powered by PSPDFKit

We’re extremely proud of all the amazing apps that have been built with the help of PSPDFKit. Our main goal has always been providing developers with the highest-quality tools so they can focus on making the best apps possible.

Dropbox
Box
Scanbot
Gumroad
Procore
Scribd
Components

Pick Your Perfect Match

PSPDFKit is made to grow with your app. You can start small and add more products when needed.

Advanced Tools

Go beyond simple viewing and markup with our advanced document tools.

4Advanced Tools

Go beyond simple viewing and markup with our advanced document tools.

Additional File Types

Support other common document file types, such as MS Office files and images.

5Additional File Types

Support other common document file types, such as MS Office files and images.

Latest from the Blog

Explore more

Ready to Get Started?

Free Trial

We use cookies to improve your experience and for marketing. Learn more in our privacy policy.