explaingit

dimuthuupe/androidpdfviewer

8,464JavaAudience · developerComplexity · 2/5LicenseSetup · moderate

TLDR

An Android library for displaying PDF files inside mobile apps with swipe navigation, pinch-to-zoom, night mode, and annotation rendering, no need to build a PDF renderer from scratch.

Mindmap

mindmap
  root((androidpdfviewer))
    What it does
      Display PDFs
      Gesture controls
      Night mode
    Features
      Pinch to zoom
      Annotation rendering
      Horizontal scroll
      Page snapping
    Load Sources
      File path
      URL
      Byte array
      App asset
    Tech
      Java
      Android
      PdfiumAndroid
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Add a PDF viewer to an Android app by attaching a PDFView component to a layout and loading from a file, URL, or byte array

USE CASE 2

Configure swipe navigation, pinch-to-zoom, and page snapping for a smooth reading experience

USE CASE 3

Enable night mode and annotation rendering for PDFs that contain comments or colored highlights

USE CASE 4

Comply with Google Play's 16 KB page alignment requirement for Android 15 apps using the scripts in the README

Tech stack

JavaAndroidPdfiumAndroid

Getting it running

Difficulty · moderate Time to first run · 30min

Version 3.x removed some older methods from version 2.x, check the migration notes if upgrading from a 2.x release.

Use freely for any purpose, including commercial apps, as long as you keep the copyright notice.

In plain English

This is an Android library that adds PDF viewing to mobile apps. Developers include it in their Android projects to display PDF documents inside their app without building a PDF renderer from scratch. It handles the rendering through a dependency called PdfiumAndroid and supports gestures like swipe, pinch-to-zoom, and double tap to zoom in. Once added to a project, you attach a PDFView component to your app layout and then load a document from a variety of sources: a file path, a URL, a byte array, a stream, or an asset bundled with the app. A configuration chain lets you control which pages to show, whether scrolling is horizontal or vertical, what happens on tap, and whether to show a scroll handle on the side. You can also enable night mode, annotation rendering (comments and colored highlights embedded in the PDF), and page snapping behavior that makes each swipe land on a full page. The library has gone through multiple major versions. Version 2.x was the stable release for a long time. Version 3.x changed parts of the API, removing some older methods and adding features like page fit policies and fling-based page turning. The current beta is 3.2.0, which adds support for the 16 KB page size alignment requirement that Google Play began enforcing in late 2025 for apps targeting Android 15 and above. The README includes scripts to verify and fix alignment in a compiled APK. Ownership of this project changed recently, and the new maintainers are looking for contributors to continue development. The library is licensed under Apache License 2.0 and works on Android API level 11 (Android 3.0) and higher.

Copy-paste prompts

Prompt 1
Add androidpdfviewer to my Android project and show me the Gradle dependency and a minimal Activity that loads a PDF from the assets folder.
Prompt 2
Configure PDFView in my Android app so swiping between pages is horizontal, each swipe snaps to a full page, and a scroll handle is visible on the side.
Prompt 3
Enable night mode and annotation rendering in androidpdfviewer and show me how to toggle night mode with a button in my Activity.
Prompt 4
My Android 15 app was rejected by Google Play for 16 KB page size alignment. Show me how to verify and fix this using the scripts mentioned in the androidpdfviewer README.
Prompt 5
I am upgrading from androidpdfviewer version 2.x to 3.x, what API methods were removed and what replaced them?
Open on GitHub → Explain another repo

← dimuthuupe on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.