Content Management

Paperless-ngx OCR Setup Guide: Configuration, Languages & Troubleshooting

J
James Eriksson
··13 min read
Complete guide to Paperless-ngx OCR setup: Tesseract configuration, Docker Compose variables, language packs, and why re-OCR fails. Learn best practices for 300 DPI scanning and troubleshoot common OCR problems.
TL;DR
  • Paperless-ngx uses Tesseract OCR via OCRmyPDF, supporting 100+ languages and three processing modes (skip, redo, force)
  • Configure OCR in Docker Compose with PAPERLESS_OCR_LANGUAGE, PAPERLESS_OCR_MODE, and optional deskew/rotate settings
  • The re-OCR button respects your OCR mode setting; if mode is skip and the document already has text, Paperless skips it by design
  • Scan at 300 DPI in greyscale for optimal accuracy; enable deskew for crooked feeds and rotate for batch scans
  • Self-host if you have low document volume and privacy needs; use managed hosting if you scan 100+ pages daily or need high availability

Paperless-ngx uses Tesseract, an open-source OCR engine, to extract text from scanned documents. It runs OCR through OCRmyPDF, which supports 100+ languages and three processing modes: skip (default), redo, and force. Setting it up means configuring Docker environment variables, installing language packs, and testing on sample uploads. This guide walks you through each step, explains why re-OCR doesn't work as you expect, and shows you when to move to managed hosting.

What is Paperless-ngx OCR and Why It Matters

Paperless-ngx converts your scanned documents into searchable, indexed text. Without OCR, a scan is just an image: you cannot search it, copy text from it, or let Paperless tag it automatically. With OCR enabled, you get full-text search, automated tag assignment, and correspondent matching across your entire document archive. This matters if you're managing more than a few hundred documents. It matters more if you archive in multiple languages.

Tesseract, the engine behind Paperless-ngx's OCR, is free and runs on your own server. No external API calls, no per-page charges, no cloud vendor lock-in. OCRmyPDF wraps Tesseract and adds the ability to embed searchable text into PDF files while keeping the original scan visible. The tradeoff: OCR is CPU-intensive. A 100-page document can take 30-60 seconds on modest hardware. If you're scanning hundreds of pages daily, that CPU cost adds up.

Paperless-ngx's OCR engine processes documents at ingest time by default. You can reconfigure it to skip OCR, redo OCR, or force a fresh OCR pass on all pages. Understanding these modes is the key to avoiding the most common gotcha: the "re-OCR" button that appears to do nothing.

Understanding OCR Engines, Languages & Modes

Tesseract is the only OCR engine Paperless-ngx uses today. It's production-ready, open-source, and trained on 100+ languages. When you set a language in Paperless-ngx, you're telling Tesseract which language pack to use. Tesseract is accurate for clean, well-scanned documents in Latin-based scripts. Accuracy drops for handwriting, low-contrast scans, and non-Latin scripts like Chinese or Arabic, though it still produces usable results.

OCRmyPDF, the library that connects Tesseract to Paperless-ngx, was built to solve a specific problem: how do you embed OCR text into a PDF without destroying the original layout? The answer is a hidden text layer. When you open a Paperless-ngx PDF in your reader, you see the original scan. When you search, you're searching that hidden text layer. OCRmyPDF defaults to converting PDFs to PDF/A format, which is archival-grade (designed to survive format changes over decades).

Three OCR modes control how Paperless-ngx processes documents:

  1. skip: Only OCR pages that have no selectable text. This is the default. If you upload a PDF that already has embedded text, Paperless skips it. If you upload a pure image, Paperless OCRs it.

  2. redo: Re-OCR every page, replacing any existing text layer. Use this when your original OCR was done by a poor-quality scanner and you want Paperless-ngx's Tesseract to do better.

  3. force: Rasterize every page (convert to image), then OCR. This destroys any existing text layer and forces a fresh OCR pass. Use this only when you need to replace bad OCR on already-OCR'd documents.

The mode you choose in PAPERLESS_OCR_MODE applies globally to all documents processed after you set it. This is why the "re-OCR" button in the UI can appear to do nothing: if mode is skip and your document already has text, Paperless refuses to touch it. This is by design (it saves CPU), but it confuses users who expect a re-OCR button to always work.

Step 1: Configure OCR in Docker Compose

If you're running Paperless-ngx in Docker, your OCR configuration lives in environment variables. Here's a minimal Docker Compose file with OCR enabled:

services:
  paperless:
    image: ghcr.io/paperless-ngx/paperless-ngx:latest
    environment:
      PAPERLESS_OCR_LANGUAGE: eng
      PAPERLESS_OCR_LANGUAGES: eng fra deu
      PAPERLESS_OCR_MODE: skip
      PAPERLESS_OCR_CLEAN: clean
      PAPERLESS_DESKEW: "true"
      PAPERLESS_ROTATE_PAGES: "true"
      # Other Paperless config (database, redis, etc.)

Break this down:

  • PAPERLESS_OCR_LANGUAGE: The primary language. Use ISO 639-2 codes: eng for English, deu for German, fra for French, chi_sim for Simplified Chinese. Paperless will download this language pack on first startup.

  • PAPERLESS_OCR_LANGUAGES: Secondary languages, space-separated. If you scan English and German documents, set this to eng fra deu (English, French, German all available). Paperless will auto-detect which language each page is in.

  • PAPERLESS_OCR_MODE: Set to skip (default), redo, or force. Start with skip.

  • PAPERLESS_OCR_CLEAN: Options are clean (default, removes background noise) or leave blank. clean helps with poor scans but takes longer.

  • PAPERLESS_DESKEW: true to auto-straighten skewed pages (a crooked scanner feed). Improves accuracy; costs CPU.

  • PAPERLESS_ROTATE_PAGES: true to auto-rotate upside-down pages. Helps with batch scans.

After you edit docker-compose.yml, restart Paperless: docker-compose down && docker-compose up -d. Paperless will download the language packs on startup. This can take 5-10 minutes if it's the first run.

Step 2: Install Language Packs (if Multi-Language)

Tesseract language packs are downloaded automatically when Paperless starts. If you set PAPERLESS_OCR_LANGUAGE: chi_sim, Paperless will fetch the Simplified Chinese pack. If you set PAPERLESS_OCR_LANGUAGES: eng deu fra, Paperless fetches all three.

Common language codes:

LanguageCode
Englisheng
Germandeu
Frenchfra
Spanishspa
Italianita
Dutchnld
Russianrus
Simplified Chinesechi_sim
Traditional Chinesechi_tra
Arabicara
Farsifas
Japanesejpn
Koreankor

If you need a language not listed, check Tesseract's GitHub: it supports 100+ total. Use the ISO 639-2 three-letter code.

One gotcha: language packs are large (10-50 MB each). If you download 10 languages, Paperless will use 100-500 MB on startup. For most users, 2-4 languages is plenty. If you're in a multilingual household or business, start with the languages you actually use. You can add more later by updating the env vars and restarting.

Step 3: Test OCR on First Upload

After you've configured and restarted Paperless, upload a test document. Here's how to verify OCR worked:

  1. Go to the Documents list and open the document.

  2. Click the "Content" tab (or scroll to the content view). You should see the scanned image.

  3. Try to select text on the image with your mouse. If you can select text, OCR worked. If the cursor is a camera icon, OCR failed or was skipped.

  4. Try a full-text search for a word you know is in the document. If the search returns the document, OCR worked. If not, check the logs.

To see what Paperless is doing, check the logs:

docker-compose logs paperless | tail -50

Look for lines mentioning "ocr" or "Tesseract". If you see errors like "language pack not found" or "Tesseract: command not found", your OCR setup has a problem. If you see "OCR skipped: document already has text", your OCR mode is skip and the document already had text (this is normal).

Why "Re-OCR" Doesn't Work (And How to Fix It)

This is the #1 point of confusion for Paperless-ngx users. You upload a document with poor OCR. You click the "Re-OCR" button in the UI. Nothing happens. You think OCR is broken.

What's actually happening: the Re-OCR button respects your PAPERLESS_OCR_MODE setting. If mode is skip (the default), Paperless sees that the document already has a text layer and skips it. The button does nothing because Paperless is following its own rules.

To fix this:

  1. If you want to re-OCR a single document with Tesseract instead of the scanner's poor OCR, change PAPERLESS_OCR_MODE to redo and restart Paperless. Upload the document again (or export and re-import it). Paperless will now overwrite the text layer.

  2. If you want to re-OCR all documents at once, change mode to redo, restart Paperless, then trigger a full re-OCR via the Admin panel: Logs & Settings > Run Document Consumer > "Reprocess". This will re-index all documents with the new OCR setting.

  3. If the existing OCR was done by your scanner and is embedded in the PDF, use PAPERLESS_OCR_MODE=force. This rasterizes the entire PDF (turns it into an image) and then OCRs it fresh. This is nuclear: it destroys the original text layer and costs CPU. Use only when necessary.

Remember: the UI's Re-OCR button doesn't have its own logic. It respects the global mode setting. If you want per-document control, you're out of luck with stock Paperless-ngx (there's a GitHub feature request for this, but it's not implemented).

Best Practices: Scanning, Resolution & Accuracy

OCR accuracy is 99% about input quality. Tesseract is a good engine, but it can't fix a blurry scan.

Scan at 300 DPI in greyscale (not color). 300 DPI is the sweet spot for Tesseract: it's accurate enough for letter-sized documents and small enough that files don't balloon. Color scans are 3x larger and don't improve OCR accuracy. Greyscale does.

If your scanner has built-in OCR, turn it off. Most consumer and office scanners' OCR is mediocre. Let Paperless-ngx do it with Tesseract. If the scanner's OCR is embedded in the PDF, use PAPERLESS_OCR_MODE=redo to override it.

For invoices, receipts, and form-based documents, 300 DPI greyscale + deskew is usually enough. For letters and regular text, same thing. For handwritten notes, Tesseract will struggle (Tesseract is not trained to read handwriting well), but it will capture some text, which is better than nothing.

For non-Latin scripts (Chinese, Arabic, Farsi): test first. Tesseract's accuracy for these languages is lower than for English (typically 85-90% instead of 95-98%). If you're archiving legal documents in Farsi, do a pilot with a few documents before you commit to archiving hundreds.

Enable PAPERLESS_DESKEW to auto-straighten crooked scans. Enable PAPERLESS_ROTATE_PAGES to auto-rotate upside-down pages. Both help, both cost CPU. For batch scans from a scanner feeder, deskew + rotate is worth it.

Troubleshooting Common OCR Failures

Symptom: OCR is not running. Documents have no text layer.

Check 1: Is OCR enabled? Set PAPERLESS_OCR_LANGUAGE to a language code (e.g., eng). Restart Paperless.

Check 2: Are language packs installed? Look at the Paperless logs for "Downloading language pack" or "language pack not found". If you see "language pack not found", the download failed. Check your network and disk space. Language packs are 10-50 MB each.

Check 3: Is your mode set to skip? If you're uploading documents that already have text layers (from your scanner's OCR), Paperless will skip them by design. Try setting PAPERLESS_OCR_MODE=redo to override.

Symptom: OCR is running but text accuracy is very poor.

Check 1: Is your scan resolution at least 150 DPI? Below that, Tesseract cannot read text reliably. Re-scan at 300 DPI.

Check 2: Is the scan color or greyscale? Use greyscale. Convert to greyscale before uploading if your scanner captured color.

Check 3: Are you scanning the right language? If you're scanning German documents and set PAPERLESS_OCR_LANGUAGE=eng, Tesseract will misread German characters. Set the language to deu.

Check 4: Is the scan blurry or low-contrast? Tesseract can't fix this. Try re-scanning with better light or a better scanner.

Symptom: OCR is very slow. Documents take 2+ minutes each.

Check 1: Is your server's CPU constrained? OCR is CPU-bound. If Paperless is running on a 1-core VM, OCR will be slow. This is normal. Consider either upgrading hardware or processing documents in batches (upload a few, let them OCR overnight).

Check 2: Are you using PAPERLESS_OCR_MODE=force? This rasterizes and OCRs from scratch, which is slower than skip or redo. Only use force when necessary.

Check 3: Are you OCRing many languages at once? If you set PAPERLESS_OCR_LANGUAGES: eng fra deu spa ita, Paperless has to load five language packs, which costs memory and startup time. Narrow it down to languages you actually use.

Check 4: Is your server low on RAM? OCR can use 1-2 GB per document being processed. If you're running multiple documents in parallel and your server has only 2 GB total, processes will swap to disk and become very slow. Add more RAM or process fewer documents in parallel (edit PAPERLESS_TASK_WORKERS).

When to Self-Host OCR vs. Managed Hosting

Self-hosting Paperless-ngx OCR makes sense if:

  • You're scanning documents once a week or less (low CPU overhead).
  • You have full-text search needs but don't want an external API (privacy).
  • Your documents are sensitive (medical, legal, financial) and must stay on your hardware.
  • You're comfortable with Linux, Docker, and basic troubleshooting.

Self-hosting breaks down if:

  • You're scanning 100+ pages daily. OCR will queue up, documents will wait hours to be processed, and your server's CPU will spike.
  • You need high availability. If your server goes down, Paperless goes down. If you need 99.9% uptime, self-hosting is risky.
  • You don't have time to maintain it. Paperless updates regularly, language packs need refreshing, and disk space fills up. Maintenance is real.
  • You're in a team and need role-based access, audit logs, and SSO. Self-hosted Paperless-ngx has none of these.

Managed hosting (like Opsily's Paperless-ngx service) handles OCR tuning for you. You don't set environment variables. You don't troubleshoot language packs. OCR just works. The tradeoff is cost and the fact that your documents live on someone else's server. For small firms and freelancers with moderate document volume, managed hosting is often worth it. You get a predictable monthly bill, no server maintenance, and 24/7 uptime. For privacy-first use cases (lawyers, doctors, accountants), self-hosting may be non-negotiable.

For details on self-hosted alternatives and cost comparisons, see our guide on self-hosted document management.

Frequently Asked Questions

What OCR engine does Paperless-ngx use?

Tesseract, an open-source OCR engine. OCRmyPDF wraps Tesseract and adds the ability to embed text into PDFs. Both are free and run on your server.

How many languages does Paperless-ngx support for OCR?

100+ languages via Tesseract language packs. English, German, French, Spanish, Italian, Dutch, Russian, Chinese, Japanese, Korean, Arabic, Farsi, and many others are available. Use ISO 639-2 three-letter language codes to specify them.

Why doesn't the "re-OCR" button work on my documents?

It respects your PAPERLESS_OCR_MODE setting. If mode is skip (default) and your document already has a text layer, Paperless skips it to save CPU. Change mode to redo or force and restart to force a re-OCR pass.

What scanning resolution is best for OCR accuracy?

300 DPI in greyscale. This is the optimal balance between Tesseract accuracy and file size. Below 150 DPI, accuracy drops sharply. Above 600 DPI, files become large but accuracy doesn't improve enough to justify it.

Can I disable my scanner's built-in OCR and use Paperless-ngx instead?

Yes. If your scanner's OCR is poor, disable it and let Tesseract handle it. If the scanner's OCR is already embedded in the PDF, use PAPERLESS_OCR_MODE=redo to have Paperless-ngx replace it with Tesseract's output.

How do I add support for multiple languages in OCR?

Set PAPERLESS_OCR_LANGUAGE to your primary language (e.g., eng) and PAPERLESS_OCR_LANGUAGES to your secondary languages, space-separated (e.g., eng deu fra). Paperless will download the language packs on startup and auto-detect which language each page is in.

Does Paperless-ngx convert PDFs to PDF/A format?

Yes, by default via OCRmyPDF. PDF/A is archival-grade and designed to survive software changes over decades. This is why Paperless-ngx converts to PDF/A: it ensures your documents remain readable long-term.

How long does OCR take per document?

Typically 1-5 minutes per 100 pages on modest hardware (2-4 core CPU). It depends on page count, scan resolution, language, and whether deskew/rotate are enabled. High-volume scenarios (1000+ pages daily) need more CPU or background processing.

The Bottom Line

Paperless-ngx OCR turns scans into searchable documents using Tesseract. Configuration is straightforward: set three environment variables in Docker Compose, restart, and test. The gotcha is understanding PAPERLESS_OCR_MODE: the default skip mode respects existing text layers, which is why re-OCR appears to do nothing. Scan at 300 DPI greyscale, enable deskew and rotate, and test with a few documents before you commit to a large archive. For high-volume scanning or high-availability needs, managed Paperless-ngx hosting removes the tuning headache and gives you predictable costs instead of server maintenance.

Skip the tuning. Start with managed Paperless-ngx.
Opsily handles OCR configuration, language packs, and performance on EU servers. No DevOps required.
Get Started Free

Ready to self-host your own apps?

One server. Multiple apps. No per-app fees.

Get started →