Error Could not load file or assembly Tesseract on Ubuntu using .Net Core 3.1


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=, 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 "" for platform x64.

To fix that I had to compile this leptonica version from here

this helped me to compile it

So now that I have "" installed I created link inside my x64 folder to leptonica files following this comment Tesseract Issue #503

Answered By – Lemo

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published