Run the Sample Apps
Foxit PDF SDK for Android includes multiple sample apps (demos) to help you learn API usage and integration patterns. The demos let you start with core PDF capabilities and progress toward a complete PDF reader application.
Before running the demos, install:
- Android Studio (Koala | 2024.1.1 or later recommended)
- Android SDK
- JDK
This guide does not cover installing Android Studio, the Android SDK, or the JDK. See the official Android developer documentation if needed.
Sample Overview
Foxit PDF SDK for Android currently provides three types of sample apps:
| Demo Type | Description |
|---|---|
| Function Demo | Standalone demonstrations of core PDF APIs |
| Viewer Control Demo | PDF viewing and interaction based on PDFViewCtrl |
| Complete PDF Viewer Demo | Full PDF reader based on UI Extensions |
Common Steps
These steps apply to all sample apps unless noted otherwise:
- In Android Studio, use File → New → Import Project… or File → Open… to import the demo project.
- Start an Android device or emulator (AVD); examples use an Android 10.0 emulator.
- Click Run → Run 'app' to launch the demo.
- When prompted for file access, choose Allow.
Function Demo
The Function Demo shows how to implement individual PDF features using the PDF Core API, useful for quickly validating specific APIs.
Included samples:
- pdf2txt: Export PDF content to a TXT file
- outline: Edit outline (bookmark) titles and display styles
- annotation: Add annotations and export to JSON
- docinfo: Export basic PDF document information
- render: Render a specified page to a Bitmap
- signature: Add signatures, sign PDFs, and verify signatures
- image2pdf: Convert images to PDF
- watermark: Add text, image, or PDF page watermarks
- search: Search text in a PDF
- graphics_objects: Create a PDF with graphics objects
When you run this demo, test files from samples/test_files are copied automatically to the device or emulator.
Tap a feature button in the app to run the operation and view results.
Viewer Control Demo (PDFViewCtrl)
The Viewer Control Demo shows typical PDF reader behavior with PDFViewCtrl (viewer control without built-in UI), for developers who plan to implement their own reader UI.
Main features:
- Annotations (highlight, underline, strikethrough, squiggly, note, etc.)
- Page layout switching
- Text search
- Outlines (bookmarks)
- Page thumbnails
Important
The Viewer Control Demo does not copy test files automatically. Before running, manually copy Sample.pdf from samples/test_files to input_files or FoxitSDK on the device or emulator (exact folder depends on demo configuration).
After the demo starts, tap anywhere on the page to open the context action bar and explore features from the more-actions menu.
Complete PDF Viewer Demo (UI Extensions)
The Complete PDF Viewer Demo shows a full PDF reader built with UI Extensions, integrating Foxit PDF SDK core features and built-in UI components.
Main capabilities:
- Built-in complete PDF reader UI
- Multi-document browsing (since v6.0)
- Thumbnails, bookmarks, search, and other common features
Run steps are the same as for the Function Demo.
Version note
Since SDK v9.1, Android Gradle Plugin (AGP) is 8.5.1 and Android Studio requires Koala | 2024.1.1 or later. To use the older AGP (4.1.3), see Downgrade AGP to 4.1.3.
When you run this demo, the following files are copied to the FoxitSDK directory on the device or emulator:
complete_pdf_viewer_guide_android.pdfSample.pdf
After launch, the home screen lists available PDF documents.
Use the switch control to enter multi-document tab mode and browse multiple PDFs.