Skip to content

Add OCR PDF export and default DPI presets#155

Closed
JFly02 wants to merge 1 commit intoChrisimx:mainfrom
JFly02:feature/ocr-dpi-presets
Closed

Add OCR PDF export and default DPI presets#155
JFly02 wants to merge 1 commit intoChrisimx:mainfrom
JFly02:feature/ocr-dpi-presets

Conversation

@JFly02
Copy link
Copy Markdown

@JFly02 JFly02 commented Apr 10, 2026

This PR adds searchable OCR PDF export and introduces clean default DPI presets for new scan sessions.

Changes:

  • add OCR PDF export option before saving/exporting
  • add default scan DPI presets: 150 / 300 / 600 / Max
  • set 300 DPI as the default preset
  • map remembered or unsupported resolutions to the closest supported scanner resolution
  • slightly improve OCR text layer placement for better search/highlight alignment

Notes:

  • fdroid debug build was verified successfully
  • unit tests are currently blocked by an existing unrelated failure in ScanSettingsStoreTest ("toMutable" unresolved)

@JFly02 JFly02 force-pushed the feature/ocr-dpi-presets branch from 0ce5ffe to 843deaa Compare April 10, 2026 20:36
@Chrisimx
Copy link
Copy Markdown
Owner

Hi @JFly02,

thank you very much for your PR.

Currently, ScanBridge is undergoing a major refactoring to move to a more Clean Architecture oriented approach.
This will definitely change a lot of things in this PR. See below for a few examples.

One independent issue, though, is that MLKit is not open-source. So, I won't be able to use the OCR part of this PR for the F-Droid version currently. For other distribution paths, I would need to change the project license to something like Apache as MLKit is GPL incompatible (but this was planned anyway).

Ideally, the OCR provider would be something truly open source, although I know that Tesseract most likely performs much worse than MLKit. But I think I can give a compromise: I suggest extracting the OCR provider to an interface so that it is easily swappable. The F-Droid version would use a Tesseract-based implementation, Google Play can use the MLKit variant and on the release page there could be multiple variants. Examples how exactly this abstraction should be structured will be found in the codebase after the refactoring, so maybe it would be better to wait for this to complete before trying to create the abstraction.

As for the setting, it is definitely a great idea. We will have to adapt this to use the new settings system that comes with the new refactoring though (Datastores are not used anymore because they are KMP incompatible, all data is managed in Room now)

@Chrisimx
Copy link
Copy Markdown
Owner

Sorry, that I can't merge this yet. Kinda of an inconvenient moment in time because of the refactor.

@JFly02
Copy link
Copy Markdown
Author

JFly02 commented Apr 12, 2026

Hi Chrisimx,

thanks a lot for the thoughtful reply and for explaining the bigger picture a bit. That all sounds very reasonable.

The licensing point around MLKit makes total sense, especially with F-Droid in mind, and I also get that this is probably the wrong moment to build too much on top of parts that are about to change during the refactoring.

I still really like the idea of OCR and the DPI setting, so I’d be happy to revisit both once the refactoring has settled down a bit. In particular, I can rework the OCR idea with a much stronger open-source focus and in a way that fits the new architecture better, ideally with a swappable provider approach like you described.

Same for the settings side: once the new Room-based system is in place, I can reimplement the DPI setting in a way that matches the new structure properly instead of forcing it into something that’s already being phased out.

Thanks again for the detailed feedback. I really appreciate it, and I’d be glad to take another pass at this later in a cleaner, more open-source-friendly form after the refactoring is done.

@JFly02 JFly02 closed this Apr 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants