If you already keep your files in Nextcloud, the annoying part of document management is rarely storage. It is the sorting. You scan a contract, photograph an ID card, download an invoice as a PDF, and the file lands in some folder where you will find it again only if you remember what you called it. Nextcloud OCR is exactly the gap that Document sorter fills: it reads the text of what you drop into an inbox, works out what kind of document it is, and files it into folders by category and kind.
This tutorial walks through a working setup on your own server, then compares it honestly with Paperless-ngx, because the two tools solve overlapping but not identical problems.
What you need first
- Nextcloud 30 to 34 and PHP 8.1 or newer.
- Nextcloud background jobs (Cron) running, since automatic sorting happens every 15 minutes.
- Python 3.8 or newer (
python3) on the server if you want pictures and scanned PDFs read. Office files and plain text sort without it. - Internet access once, for the reader installation, which downloads the Python packages.
- A license for the app (one per Nextcloud instance). The full details are in the user guide.
Step 1: Install and enable the app
Download the archive docsort-x.y.z.tar.gz from your MediaLab Works account under Licenses, then extract it into your apps folder so you end up with apps/docsort/, owned by the web-server user:
cd /var/www/nextcloud/apps
sudo tar -xzf ~/docsort-x.y.z.tar.gz
sudo chown -R www-data:www-data docsort
Enable it from the command line or from the Apps page:
sudo -u www-data php occ app:enable docsort
Then open Administration settings → Document sorter → License, paste your license key and save. The app contacts the license server, binds the key to this instance and shows the license as Active. The check runs once a day; without internet the app keeps working for 7 days after the last successful check. If the license is not valid, sorting simply stops and files wait in the inbox — nothing is deleted.
Step 2: Install the document reader
In Administration settings → Document sorter, press Install the reader. A background job builds a Python environment in the data directory (appdata_<id>/docsort/python) with RapidOCR, pypdfium2 and OpenCV. Expect roughly 150 MB to download and about 500 MB on disk. If you prefer the terminal:
sudo -u www-data php occ docsort:install
Use --remove to start over, or the Remove and install again button in the settings. This reader is what makes RapidOCR text extraction work on photos and scanned PDFs; PDFs that already contain a text layer are read directly, and office files are read from the XML inside them.
Step 3: Set up your personal inbox
Each user configures this for themselves under Personal settings → Document sorter:
- Switch on Sort my documents.
- Set the Inbox folders, one per line, relative to your files. The default is
Documente/De sortat(Romanian for “Documents/To sort”). - Choose where sorted documents go — default
Documente. - Pick what happens to a recognized document: move it, copy it (the original stays in the inbox), or only tag it.
- Choose a folder per category and then per kind, or one folder per kind.
- Decide what happens to documents that are not recognized: they stay in the inbox, or go to an Unsorted folder.
- Choose folder and tag names in Romanian or English.
That last point matters if you share the instance with family or colleagues: the same rules produce either Documente/Financiar/Factura or Documents/Finance/Invoice, depending on the setting.
Step 4: Drop files in and watch them get filed
Put scans, photos and PDFs into the inbox folder from the web interface, the desktop client or your phone. Within 15 minutes each file is read, recognized, tagged Document: <kind> and moved to Documente/<category>/<kind>/.
On the personal page, Sort now runs it immediately, and Only show what would happen previews the result without moving anything. Recently sorted lists what was filed and where. From a terminal you can also run:
sudo -u www-data php occ docsort:scan [user] [--dry-run] [--again] [--limit N]
sudo -u www-data php occ docsort:classify <file> [--text]
The first sorts the inbox of everybody or one person (with a dry run option); the second shows what a single file would be sorted as.
The 48 kinds in 13 categories
Out of the box the app recognizes 48 document kinds grouped into 13 categories: identity, civil status, permits and licenses, vehicle, finance, legal, property, health, education, work, utilities, insurance and other. Each kind is a list of keywords with weights, in Romanian and English, with a minimum score. That is why an ID card and a birth certificate end up in different folders without you naming a single file correctly.
Step 5: Tune the rules when a guess is wrong
The rules are plain JSON with the fields id, category, en, ro, min and keywords. As administrator you can edit them under Rules, press Save rules, or return to the built-in rules at any time. Before saving, use Try the rules: paste the text of a document, press Classify, and see what it would be sorted as and which words decided. Nothing is stored. That is the fastest way to fix a recurring misfile — add the missing word to the right kind and move on.
Troubleshooting
- Pictures and scanned PDFs are not sorted, office files are: the reader is not installed. Administration settings → Overview shows a warning; install it from the Document sorter section.
- “No Python 3 was found on this server”: install it (
apt install python3 python3-venv) and press Install the reader again. - The installation fails while downloading: the server needs internet access once to fetch the Python packages. Check proxy and firewall, then retry.
- A file stays in the inbox tagged
Document: ?: no kind reached its minimum score. Check the text with Try the rules and add the missing words.
One privacy note worth repeating: the text of a document is never stored. The app only remembers what each file was recognized as, so the same file is not read twice. Everything runs on your server; no document is sent anywhere.
Document sorter vs Paperless-ngx, honestly
Paperless-ngx is a dedicated document archive: it has its own database, its own web interface, its own consumption folder and its own idea of how documents should be stored. If your goal is a searchable archive with correspondents, document types and a strong full-text search, it is a mature and excellent choice. It does one job and does it deeply.
Document sorter takes a different position. It does not build a second archive next to Nextcloud; it works inside the file tree you already have. Scans stay ordinary files in ordinary folders, reachable from the desktop client, the mobile app and every other Nextcloud feature. The app adds recognition, tagging and filing on top, per user, with each person choosing their own inbox, destination and mode. For a household or a small team already living in Nextcloud, that means no second system to back up, no second login, and no migration of existing folders.
The trade-off is real: Document sorter is a sorter, not an archive with its own metadata model and search interface. If you need Paperless-style correspondents and a dedicated document database, Paperless-ngx remains the better fit. If what you actually want is for Nextcloud to stop being a mess of unsorted scans, this is the smaller, more natural tool.
Conclusion
A working Nextcloud OCR setup takes three things: the app enabled with a valid license, the reader installed for pictures and scanned PDFs, and an inbox folder each user actually uses. From there the 15-minute job does the boring part, the rules stay editable in JSON, and Try the rules lets you fix mistakes without guessing. Start on the product page, keep the guide and changelog handy, and if something behaves oddly, the knowledge base and FAQ are the next stop.