How to view PDFs on Android

Table of contents

    How to view PDFs on Android
    Summary

    Compare three approaches for viewing PDFs in Android: PdfRenderer (Android SDK), Android PdfViewer (open source), and Nutrient SDK (commercial with annotations, forms, and signatures).

    This article covers three approaches for displaying PDFs in Android apps: the Android SDK’s PdfRenderer, the open source Android PdfViewer library, and Nutrient’s Android PDF SDK.

    Prerequisites

    Before starting, ensure you have:

    • Android Studio installed
    • Basic knowledge of Kotlin or Java
    • An Android project with minimum SDK 21 (Android 5.0)

    Displaying PDFs using the Android SDK

    The Android SDK has had basic support for PDF files since API level 21 (Android 5.0). This API resides in a package, android.graphics.pdf(opens in a new tab), and it supports basic low-level operations, such as creating PDF files and rendering pages to bitmaps. The Android SDK doesn’t provide a UI for interacting with PDF documents, so you’ll need to write your own UI to handle user interaction if you wish to use it as a basis for a PDF viewer in your app.

    The main API entry point is PdfRenderer(opens in a new tab), which provides an easy way to render single pages into bitmaps:

    // Create the page renderer for the PDF document.
    val fileDescriptor = ParcelFileDescriptor.open(documentFile, ParcelFileDescriptor.MODE_READ_ONLY)
    val pdfRenderer = PdfRenderer(fileDescriptor)
    // Open the page.
    val page = pdfRenderer.openPage(pageNumber)
    // Render the page to the bitmap.
    val bitmap = Bitmap.createBitmap(page.width, page.height, Bitmap.Config.ARGB_8888)
    page.render(bitmap, null, null, PdfRenderer.Page.RENDER_MODE_FOR_DISPLAY)
    // Use the rendered bitmap.
    ...
    // Close the page when you're done with it.
    page.close()
    ...
    // Close the `PdfRenderer` when you're done with it.
    pdfRenderer.close()

    You can now set these rendered bitmaps into an ImageView or build your own UI that handles multipage documents, scrolling, and zooming.

    Rendering PDFs with the Android PdfViewer library

    Android PdfViewer(opens in a new tab) is a library for displaying PDF documents. It has basic support for page layouts, zooming, and touch gestures. It’s available under the Apache License, Version 2.0 and, as such, is free to use, even in commercial apps.

    Integration is simple. Start with adding a library dependency to your build.gradle file:

    compile 'com.github.barteksc:android-pdf-viewer:3.1.0-beta.1'

    Then add the main PDFView to the layout where you wish to view the PDFs:

    ...
    <com.github.barteksc.pdfviewer.PDFView
    android:id="@+id/pdfView"
    android:layout_width="match_parent"
    android:layout_height="match_parent"/>
    ...

    Now you can load the document in your activity:

    ...
    val pdfView = findViewById<PdfView>(R.id.pdfView)
    pdfView.fromUri(documentUri).load()
    ...

    Nutrient Android SDK

    The solutions above are free or open source libraries with basic viewer capabilities. However, the PDF spec is fairly complex, and many apps require features beyond simple viewing. Nutrient Android SDK provides:

    • Annotation editing
    • Interactive forms with JavaScript support
    • Digital signatures
    • Indexed search
    • Document editing (programmatically and through the UI)
    • Redaction

    If you’re interested in our solution, visit the Android product page to learn more and download a free trial.

    Getting started with Nutrient Android SDK

    To integrate Nutrient into your Android app, follow the steps outlined below.

    Step 1 — Creating a new project

    1. Open Android Studio and select File > New > New Project….
    2. Choose the appropriate template for your project. In this example, select Empty Activity.
    3. Provide the app name (e.g. Nutrient Demo) and set the save location, the language, and the minimum SDK to 21 or higher.

    Step 2 — Adding Nutrient to your project

    1. In your settings.gradle.kts file, add the Nutrient Maven repository:
    dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
    google()
    mavenCentral()
    maven {
    url = uri("https://my.nutrient.io/maven")
    }
    }
    }
    1. In your app/build.gradle.kts file, add the Nutrient dependency:
    dependencies {
    implementation("io.nutrient:nutrient:11.2.1")
    }

    Step 3 — Configuring your build

    As of September 2025, Nutrient supports Android devices running API level 21 and above. Note the SDK versions may need updating to the latest version in the future.

    Make sure your app/build.gradle.kts file has the following configuration:

    android {
    compileSdk = 35
    defaultConfig {
    applicationId = "com.example.app"
    minSdk = 23
    targetSdk = <latest>
    }
    }

    Step 4 — Displaying a PDF document

    To verify that Nutrient has been successfully integrated into your app, open a PDF file with the ready-to-use PdfActivity.

    • Optional: If you have a trial or license key, add it to your AndroidManifest.xml:
    <application>
    <meta-data
    android:name="nutrient_license_key"
    android:value="YOUR_LICENSE_KEY_GOES_HERE" />
    ...
    </application>
    • Copy a PDF document to the assets directory of your Android project, e.g. src/main/assets/my-document.pdf.
    • Add PdfActivity to your app’s AndroidManifest.xml:
    <application>
    ...
    <activity
    android:name="com.pspdfkit.ui.PdfActivity"
    android:theme="@style/Theme.AppCompat.Light.NoActionBar"
    android:windowSoftInputMode="adjustNothing" />
    </application>
    • Start PdfActivity with the document from your assets directory:
    class MainActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    setContentView(R.layout.activity_main)
    val uri = Uri.parse("file:///android_asset/my-document.pdf")
    val config = PdfActivityConfiguration.Builder(this).build()
    PdfActivity.showDocument(this, uri, config)
    }
    }
    class MainActivity extends AppCompatActivity {
    @Override
    protected void onCreate(@Nullable final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    final Uri uri = Uri.parse("file:///android_asset/my-document.pdf");
    final PdfActivityConfiguration config = new PdfActivityConfiguration.Builder(context).build();
    PdfActivity.showDocument(this, uri, config);
    }
    }

    PdfActivity will now present the document from your assets directory.

    The android_assets folder is read-only and serves as a simple example. For practical use, consider copying the file to a local folder for full read and write privileges. Learn more from our guide on opening PDFs from URLs and Google’s Data and file storage overview(opens in a new tab).

    Conclusion

    This post covered free PDF viewer options for Android. For advanced features like annotations, interactive forms, and digital signatures, Nutrient Android SDK provides a customizable solution with well-documented APIs. Try it for free or explore the demos.

    FAQ

    How can users annotate and sign PDFs in my Android app?

    Free libraries only support viewing. Nutrient SDK enables users to highlight text, add comments, draw ink annotations, and apply legally binding digital signatures — all saved directly to the PDF.

    How do I let users fill out PDF forms on Android?

    PdfRenderer and Android PdfViewer don’t support forms. Nutrient SDK renders interactive form fields (text, checkboxes, dropdowns) and supports JavaScript validation, so users can complete forms without leaving your app.

    Can I build a document editing feature into my Android app?

    Yes. Nutrient SDK lets users merge, split, rotate, and reorder PDF pages through the UI or programmatically. Users can also redact sensitive content with permanent removal.

    How do I search text inside a PDF on Android?

    Basic viewers don’t include search. Nutrient SDK provides indexed full-text search across an entire document, returning results instantly, even in large PDFs.

    What if I need to support multiple platforms beyond Android?

    Nutrient offers SDKs for iOS, web, Flutter, React Native, and server-side processing. Documents and annotations stay consistent across all platforms, so users get the same experience everywhere.

    Tomáš Šurín

    Tomáš Šurín

    Server and Services Senior Staff Software Engineer

    Tomáš has a deep interest in building (and breaking) stuff both in the digital and physical world. In his spare time, you’ll find him relaxing off the grid, cooking good food, playing board games, and discussing science and philosophy.

    Explore related topics

    Try for free Ready to get started?