
put ( "num", 1 ) // Only supports one page (Note: The processOCR method will be implemented later in the guide.) // Add callback to handle returned image from scanner val scannerLauncher = registerForActivityResult ( ScannerContract ( ) ) val jsonObj = JSONObject ( ) val jsonPages = JSONArray ( ) val jsonPage = JSONObject ( ) You can launch the scanner and handle the returned image by calling the following in your MainActivity. We'll use this library to capture, crop, and filter images using the built-in camera. Next, as mentioned previously, the Android app will use our fork of a third-party Android document scanner library, found here. Integrate the PDFTron library via Gradle, as described here. To keep things simple, the OCR portion uses Google's ML Kit Text Recognition APIs, while the client scanner app is based on our fork of a third-party Android document scanner library, AndroidScannerDemo.Ĭlient Setup for Android Document Scanner with PDFTron SDKĬreate a new Android project using Android Studio.Īdd Google's ML Kit Text Recognition Android libraries as described in the ML Kit guide.ĭownload the following AAR file and add the AAR as a new module dependency in your project. Sample code for this post and an Android document scanner example can be found on Github, and you can try our sample by installing the APK here.
Download document editor for android pdf#
And since we’re using PDFTron to view the resulting PDF file, we can also annotate and edit the document! This makes text in your scanned documents searchable and selectable.
Download document editor for android how to#
In this post, we recreate this feature and take it a step further, teaching you how to create a document scanner app for Android using PDFTron’s OCR module. But the resulting PDF document only contains static images without any interactive text. Document scanner apps are one of the more popular tools that make smart use of mobile device features, like the built-in camera and touch-screen, to make scanning both convenient and practical for virtually anyone.įor example: Google Drive’s document scanning feature lets you take pictures of items such as receipts, letters, billing statements, etc.
