Nextcloud OCR: every PDF in a folder becomes searchable
Name a folder, and each PDF or scan that lands in it is read and made searchable. Which means: full-text search finds the invoice from your scanner.
Searchable PDF in Nextcloud with a Flow rule
An administrator adds a Flow rule, "Read with ocr-software.com", for one folder, subfolders included. Every PDF, PNG, JPEG or TIFF in it is read in a background job, and you get a searchable PDF, or both a searchable PDF and a Markdown file name.md next to it. Markdown needs the pipeline for hard pages, chosen in the settings (see the install steps). The searchable PDF replaces the original (Nextcloud keeps the old content as a version) or lands as name.ocr.pdf beside it.
Nextcloud OCR without OCR software on your server
Some Nextcloud OCR apps need OCR software installed on your server. This one installs nothing besides itself: the OCR runs on the API, so your server needs no OCR software and no GPU.
OCR in the Nextcloud Assistant
The app adds the task type "Optical character recognition" to the Assistant. Pick a file and get its text back as Markdown. It reads PDF, PNG, JPEG and TIFF.
Nextcloud full text search for scanned PDFs
The searchable PDF works in every PDF reader at once: open it and search with Ctrl+F. The search bar of Nextcloud looks only at file names, tags and comments. To find a word from the text layer there, install the three Full text search apps from the App Store (the base app, its Files part and its Elasticsearch part), and run an Elasticsearch server they can reach.
The index follows the OCR on its own. When the rule replaces a scan with the searchable PDF, Nextcloud reports the file as changed, and the next indexing run picks it up. That run happens every 12 minutes with Cron as background job mode, so a new scan is found after about 15 minutes at most.
Many scans at once
Each upload is handed to the API in a short background job that ends at once; results are collected every 5 minutes. The app keeps 2 jobs open at the API at a time, and the other files wait in a table of the app. If the API does not accept a file for 24 hours, the Nextcloud log says "gave up" and the file stays as it was; upload it again to start a new job. Thousands of scans in one folder do not hold up the other jobs of your Nextcloud.
Install the Nextcloud OCR app in three steps
The app is not in the Nextcloud App Store yet. You install it from the repository.
Build and unpack
Build the archive from the repository and unpack it into the folder custom_apps.
Enter your key
Add your API key in the settings; the pipeline is optional.
Create the rule
Add the Flow rule for your folder.
git clone https://github.com/ocr-software/nextcloud-ocr-software.git
cd nextcloud-ocr-software
bash package.sh
tar -xzf build/ocr_software-*.tar.gz -C /path/to/nextcloud/custom_apps
sudo -u www-data php occ app:enable ocr_software
You need an API key for the hosted service: get your API key. In Administration settings, Assistant, enter the key. The pipeline field can stay empty: the app then uses the fastest and cheapest one, and the form names it. You can choose another; the three pipelines of this version are described on the pipelines page:
- Fast (the default): clean and scanned pages, text and a box for every word. Start here for an archive.
- Tables: pages with tables, where every cell keeps its row and column.
- Hard pages: poor scans and fax, slower; the only one that also gives the Markdown file, and only when you choose it yourself.
Then create the rule under Administration settings, Flow. It needs Nextcloud 33 to 35 (tested on 33) and PHP 8.2 or newer; the README lists what is skipped, for example PDFs with a text layer, encrypted and signed PDFs.
What stays on your Nextcloud server, what leaves it
Each file goes to the API address in the settings. The uploaded document is deleted when the job ends, and the result stays retrievable for 24 hours. The app deletes the result right after it fetched it. Page counts and usage records stay with the service; see the privacy policy. If a file must not leave your server, point the app to the package on your own server.
Run the Nextcloud OCR app against your own server
The app also works against the package on your own server: change the field "API address" in the admin form (https; plain http only for private network addresses). To run the server itself, follow the install guide.
Production use, high volume or your own server?
Private use and tests are free. For a company in production, a server of your own or a pipeline built on your pages, send the kind of page and the volume, and get a written offer.