How to Build Your Own PDF Powerhouse in Kotlin Without Sending Data to the Cloud
Recently, I needed to quickly compress a heavy PDF document on my smartphone. I opened Google Play, typed in the search, and... got discouraged. Most apps are either buried under ads, require a subscription, or — worst of all — send your file to some third-party server for processing. For documents with personal data or work reports, this is simply not an option.
On GitHub, I came across the PDF Toolkit project by developer Karna14314. It's a fully offline utility for Android, written in Kotlin and Jetpack Compose. It does everything that paid alternatives do, but follows a privacy-first principle: no internet, no analytics, and no cloud.
What this Swiss Army knife can do
The author packed virtually all basic operations you might need when working with documents into the app. If we break down the features by category, we get a decent list.
First, there are classic page manipulations. You can merge several files into one (Merge) or, conversely, split a document into parts. There's a visual editor where you can drag pages with your finger to change their order, or simply delete the ones you don't need. For heavy files, there's compression without loss of readability.
Second, conversion. The app can turn images from your gallery into PDF and vice versa — extract document pages in JPG, PNG, or WebP format. There's even a built-in scanning function: you point the camera, the app finds the edges of the page on its own, and creates a neat scan.
Third, content work and security. You can add watermarks, set passwords on files (or remove them if you know the old one), and even sign documents right on the screen. OCR — text recognition from images — deserves a special mention.
Technical internals
For Android developers, PDF Toolkit is interesting for its architecture. The project is fresh, so it uses a modern stack:
- UI: Fully on Jetpack Compose following Material Design 3 conventions.
- Architecture: Classic MVVM combined with Clean Architecture. The code is neatly organized, PDF processing logic is separated from the UI layer.
- PDF processing: Uses PdfBox-Android. This is a port of the well-known Apache library that works reliably under the hood of the mobile OS.
- OCR (Text recognition): Here the author used an interesting solution with build flavors.
Three build variants are available in the repository:
- Play Store: Uses Google ML Kit for text recognition. This makes the APK smaller (about 40 MB is downloaded on first launch), but adds a dependency on Google's proprietary service.
- F-Droid / Opensource: These versions use Tesseract (tess-two library). This is a fully open engine that works 100% offline. Perfect for those who want maximum vendor independence.
Coroutines and Flow are used for async tasks, and local data storage (such as operation history) relies on Room and DataStore.
Why it's worth studying
If you write in Kotlin, the project is a great example of how to work with heavy files and images in Android. In the code, you can find implementations of CameraX for document scanning or usage of AndroidX Ink for annotations and signatures.
Image handling is implemented interestingly. The project uses several popular libraries at once: Coil for loading, Glide for specific tasks, and uCrop for cropping images before inserting them into PDF.
Who will find this project useful
If you're looking for a ready-made app for yourself, PDF Toolkit is an honest tool with no hidden catches. It doesn't ask for internet access (the permission is simply not in the manifest), which means your files physically cannot leave your device.
For developers, this is a ready-made app template with proper architecture. You can fork the repository and add, for example, export to other formats or specific metadata processing.
The project is actively developed, the author is open to pull requests. The only caveat: to build from source, you'll need Android Studio Hedgehog or newer and JDK 17.
Building the project is simple:
git clone https://github.com/Karna14314/Pdf_Tools.git
cd Pdf_Tools
# Если нужен полностью открытый вариант без Google-сервисов:
./gradlew assembleOpensourceRelease
In the end, we have a solid open source project that solves a real privacy problem. In a world where every other app tries to collect data about you, utilities like this are a breath of fresh air.
Related projects