Repository navigation
Description
OCR support in FairScan
OCR is a commonly requested features for FairScan, at least by advanced users.
OCR can be quite valuable, but it is also a complex feature to implement well, especially on-device, without compromising UX, performance or reliability.
This issue is mainly about doing OCR right, not just adding an OCR checkbox.
This is not a short-term promise.
What FairScan aims to provide (ideal outcome)
The goal is to generate searchable PDFs with an invisible text layer:
- The scanned page remains a raster image.
- OCR text is embedded invisibly on top of the image.
- Users can:
- select and copy text,
- search text inside the PDF,
- see search highlights at the correct locations.
In the UX, OCR should feel transparent to the user when scanning a document:
- No dedicated OCR screen.
- OCR is triggered automatically with no user interaction
- OCR could be mentioned in the export screen for example to confirm that detected text is added to the document, e.g. "Text: 42k characters"
OCR will probably be opt-in since many users don't know what it is and might be confused by a longer processing time. It would be activated in the application settings.
What is explicitly out of scope (at least initially)
To keep UX simple and reliable, the following are out of scope for a first OCR version:
- Real-time OCR during capture.
- Handwritten text recognition.
- Perfect character-level placement.
- Automatic language detection.
Non-goals:
- manual OCR tuning per page
- bounding boxes shown to the user
- editable text layer
Challenges with OCR on Android
Key challenges include:
- OCR engines are very sensitive to image quality.
- Correctly mapping OCR bounding boxes from image space to PDF coordinates.
- Preserving baselines, font sizes and alignment well enough for good text selection.
- Performance on mobile devices.
Poor placement or slow execution may lead to a worse user experience than having no OCR at all.
Dependency on image post-processing
OCR results will depend on FairScan's image processing including:
- document detection and cropping,
- contrast / brightness adjustment,
- deskewing,
- sharpening?
- denoising?
- OCR-friendly resolution (300 dpi)
As of today, FairScan has no deskewing, sharpening nor denoising.
Automatic contrast and brightness adjustment should be improved to be more reliable (see #80).
Management of captured images should be revamped to keep images in the original resolution: this could be done as part of #70
Improving post-processing of captured images benefits all users, even without OCR.
OCR engines
Requirements for an OCR engine:
- open source
- offline
- can run on Android without a massive integration effort
- can run in a reasonable amount of time on a mobile device, e.g. < 1 second per page on recent devices
- doesn't have a huge impact on the size of the APK
Known options:
Managing languages
OCR engines like Tesseract have separate models per language. Those models can be heavy: like several megabytes per language for Tesseract "fast" models.
A possible way to manage languages :
- APKs don't include any model
- To activate OCR in the app settings, the user has to trigger the download of one or more language models
- When a document is scanned, all installed language models are used (that might be refined later)
FairScan would then require the "internet" permission: the privacy policy should then be updated.
Activity
jeffreyd00 commentedon Dec 14, 2025
Up vote for OCR!
Redsandro commentedon Dec 20, 2025
Yes, that would be preferred. I use this on Desktop Linux so I scan only to JPEG using FairScan. It would be helpful if FairScan does everything so I don't have to post-process my scans.
nekohayo commentedon Dec 23, 2025
One thing that would be very important for me in terms of UX would be the ability to specify the default preferred OCR languages, and have the ability to override the language per-document.
Being in a multilingual country, many receipts would be in French by default, but some would be in English, etc. and when I'm travelling I would surely encounter Spanish, German, etc. receipts.
Redsandro commentedon Dec 23, 2025
@nekohayo Same for me. Best to use two languages e.g.:
bobpaul commentedon Dec 23, 2025
@mtotschnig has a launcherless OCR app that listens to intents and returns text from Tesseract. This lets other Android apps use Tesseract without including the library in every app that wants to use OCR. Here it is on Fdroid. I think that seems worth looking at as it would allow users who don't need OCR to install just FairScan. FairScan could prompt users who want OCR to install the OCR app.
pynicolas commentedon Dec 25, 2025
Thank you for all the suggestions and pointers. I may try to investigate OCR integration some time in the near future. My main focus will be to have a solution that doesn't make the scanning process more complex for users.
PhilLab commentedon Jan 25, 2026
@pynicolas Also an interesting inspiration for this: the Android app https://github.com/egdels/makeacopy. It includes
A similar architecture could be applicable to FairScan, maybe.
pynicolas commentedon Jun 13, 2026
Done in #198. It will be shipped in the next release.
It seems to work correctly, at least for a first version.
I checked various languages, including Russian and Chinese, and a few PDF viewers.
There are probably many things to improve.
If you encounter a problem, please open a new issue and attach (or send to contact@fairscan.org) the captured image: go to the "About" screen and tap "Report a problem with last captured image". That makes it possible to reproduce the problem you see and investigate it.