OCR languages
The OCR tool can only offer languages whose Tesseract language pack is installed on the server. The standard Docker images include English, German, French, Portuguese and Simplified Chinese. The ultra-lite image has no OCR.
Stirling PDF uses OCRmyPDF when it is installed, as it is in the standard and fat images, and falls back to Tesseract alone otherwise. The OCR tool's Processing Options only work with OCRmyPDF.
Download languages in the app#
- Open Settings → Server → Advanced. The Processing card shows the Tessdata Directory and its installed languages.
- Under Download additional tessdata languages, pick the languages, then select Download selected languages.
The server downloads them from the tesseract-ocr/tessdata repository, so it needs internet access. If the folder is not writable, the app gives you download links instead; save the files into the tessdata folder yourself.
In Docker, the tessdata folder is inside the container, so languages downloaded this way are lost when the container is recreated. Use a volume, below, for languages you want to keep.
Add languages with a Docker volume#
-
Download the
.traineddatafiles you need from tessdata (more accurate, larger) or tessdata_fast (faster, smaller). -
Put them in a host folder and mount it at
/usr/share/tessdata:yamlservices: stirling-pdf: volumes: - ./tessdata:/usr/share/tessdata -
Restart the container.
At startup, files in /usr/share/tessdata are copied into Tesseract's own folder, /usr/share/tesseract-ocr/5/tessdata. Files already there are not replaced.
Add languages without Docker#
sudo apt install tesseract-ocr-spa # one language (Spanish)
apt search tesseract-ocr- # list available languagessudo dnf install tesseract-langpack-spa # one language (Spanish)
dnf search tesseract-langpack- # list available languages-
Download the
.traineddatafiles from tessdata or tessdata_fast. -
Put them in the
tessdatafolder of your Tesseract install, such asC:\Program Files\Tesseract-OCR\tessdata, and check withtesseract --list-langs. -
Point Stirling PDF at that folder in
settings.yml, then restart:yamlsystem: tessdataDir: C:/Program Files/Tesseract-OCR/tessdata
Keep eng.traineddata in the folder: English is always needed.
The tessdata folder is chosen in this order: system.tessdataDir, then the TESSDATA_PREFIX environment variable, then /usr/share/tesseract-ocr/5/tessdata.