I am using Tesseract version 4.1.1 on dotnetcore 3.1 project which works perfectly on windows but when I publish it on ubuntu it throws the following error on this line
new TesseractEngine(Tessdatapath, LanguageCode, EngineMode.TesseractAndLstm);
Could not load file or assembly 'Tesseract, Version=126.96.36.199, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.
I copied the x64 & x86 dlls with the publish files and made sure they are on the same level with tessdata
I tried to install tesseract on ubuntu and copied the .so files inside the x64 & x86 folders but still no luck
So here is how I fixed it
It turned out that system didnt display the correct error message because it couldnt use the library System.Drawing.Common which is not supported by Linux.
Fixed that by using libgdiplux the Linux implementation of System.Drawing.Common
sudo apt-get -f install libgdiplus
Then it displayed the correct message which is
Failed to find library "libleptonica-1.80.0.so" for platform x64.
To fix that I had to compile this leptonica version from here http://www.leptonica.org/download.html
this helped me to compile it
So now that I have "libleptonica-1.80.0.so" installed I created link inside my x64 folder to leptonica files following this comment Tesseract Issue #503
Answered By – Lemo