Skip to content

Configuring OCR engine

OpenKM can work with several OCR engines, like Tesseract.

Tesseract is an open-source OCR engine adopted by Google. It works really well. OCR can natively read TIFF documents and has a high recognition rate with images of 300 dpi resolution that are converted to lineart (1-bit color).

The supported image formats are:

  • TIFF
  • PNG
  • JPG
  • GIF
OS Description
Ubuntu and Debian bash<br>$ apt install tesseract-ocr<br>
The default installed language is English, so depending on your locale you may want to install another language file.
For example, to install the Spanish language pack:
bash<br>$ apt install tesseract-ocr-spa<br>
You can check the installed languages this way:
bash<br>$ tesseract --list-langs<br>
More information at:
- https://github.com/tesseract-ocr/tesseract
- https://tesseract-ocr.github.io/tessdoc/Installation.html
Red Hat and CentOS On CentOS, you can install Tesseract from the EPEL repository:
bash<br>$ yum install epel-release<br>$ yum install tesseract<br>
The default installed language is English, so depending on your locale you may want to install another language file.
For example, to install the Spanish language pack:
bash<br>$ yum install tesseract-langpack-spa<br>
You can check the installed languages this way:
bash<br>$ tesseract --list-langs<br>
On Red Hat, we recommend contacting Red Hat support for more information.
More information at:
- https://tesseract-ocr.github.io/tessdoc/Installation.html
Windows Download from https://tesseract-ocr.github.io/tessdoc/Installation.html and follow the installation wizard.

From the command line, execute (where image.jpg should be an existing image file):

Terminal window
$ tesseract image.jpg text

Go to Administration > Configuration parameters and edit the parameter named system.ocr:

OS
Linux /usr/bin/tesseract ${fileIn} ${fileOut}
or
/usr/bin/tesseract ${fileIn} ${fileOut} -l esp
The parameter -l esp indicates that the Spanish language support must be used while executing OCR.
To see all Tesseract options, execute:
bash<br>$ tesseract<br>
Windows c:\Tesseract-ocr-3.0.2\tesseract.exe ${fileIn} ${fileOut}
or
c:\Tesseract-ocr-3.0.2\tesseract.exe ${fileIn} ${fileOut} -l spa
The parameter -l esp indicates that the Spanish language support must be used while executing OCR.
To see all Tesseract options, execute:
bash<br>c:\Tesseract-ocr-3.0.2> tesseract.exe<br>
  • The parameter ${fileIn} will be replaced internally by the image document to be processed.
  • The parameter ${fileOut} will be replaced internally by a temporary text file.
  • You can set other additional parameters like the -l spa parameter in the example.

You can also use an OpenOffice.org dictionary to enhance the OCR process. You can find these language-specific dictionaries at OpenOffice.org Dictionary Repository.

Go to Administration > Configuration parameters and edit the parameter named system.openoffice.dictionary:

OS
Linux /home/openkm/dictionary/en-GB.zip
Windows c:\tomcat-8.5.69\dictionary\en-GB.zip

There’s a configuration parameter that forces OCR on rotated documents.

Go to Administration > Configuration parameters and edit the parameter named system.ocr.rotate:

Property Description
system.ocr.rotate The parameter is a collection of degrees separated by the character “;”.
90;180;270;