AndroidPdfViewer
Android view for displaying PDFs rendered with PdfiumAndroid
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.
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.
Where it fits
- 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
- Configure swipe navigation, pinch-to-zoom, and page snapping for a smooth reading experience
- Enable night mode and annotation rendering for PDFs that contain comments or colored highlights
- Comply with Google Play's 16 KB page alignment requirement for Android 15 apps using the scripts in the README