OCRmyPDF
Install OCRmyPDF and Tesseract to create searchable PDFs from scanned documents.
ansible-playbook -i inventory -K playbooks/lab-stack.yml --tags ocr🔧 Manual setup and configuration
- Log out and log back in after running the role so Nautilus/Nemo reload user actions.
- In Nautilus, right-click a PDF and use OCR PDF (ocrmypdf).
- The action runs
~/.local/bin/ocrmypdf-wrapperand writes*_ocr.pdfnext to the original file. - The wrapper defaults to German + English OCR (
-l deu+eng) and skips pages that already contain text. - Review
~/.cache/ocrmypdf-wrapper.logif conversion fails.
✅ Check
ocrmypdf --version
tesseract --versionExpected: both commands print a version.
echo "test" > /tmp/ocr-test.txt
enscript /tmp/ocr-test.txt -o - | ps2pdf - /tmp/ocr-test.pdf
ocrmypdf -l eng /tmp/ocr-test.pdf /tmp/ocr-test_ocr.pdf
pdfinfo /tmp/ocr-test_ocr.pdf | sed -n '1,5p'Expected: /tmp/ocr-test_ocr.pdf is created successfully.
ls -l ~/.local/share/file-manager/actions/ocrmypdf.desktop
ls -l ~/.local/share/nemo/actions/ocrmypdf.nemo_actionExpected: at least one action file exists (depending on your file manager).
Nautilus right-click action behavior
- Menu entry:
OCR PDF (ocrmypdf) - File type: appears for PDF files (
application/pdf) - Execution: calls
~/.local/bin/ocrmypdf-wrapper "%f" - Output naming: input
paper.pdfbecomespaper_ocr.pdf - Batch behavior: the wrapper accepts multiple files and processes each one in sequence
- Troubleshooting: if the menu entry does not appear, restart Nautilus (
nautilus -q) or relogin