Unable to load DLL 'tesseract.dll' |
I having issues getting the Tesseract.Net library to locate the tesseract.dll in an MVC web project.
I've followed your installation instructions (marking both x86 and x64 versions as Copy to Output Directory=Copy always) and it works fine in a class library and WinForms application. The web site cannot seem to find it though. I've verified the tesseract.dll is copied to the bin folder along with the Patagames.Ocr.dll and have even tried adding tesseract.dll manually in different spots. Do you have any other suggestions?
This is happens because the Web application is running in a IIS's working directory, unlike the classical apps. In consequence of that, the LoadLibrary function can't find the tesseract.dll during initialization process.
You can specify the full path to tesseract.dll through PathToEngine property of OcrApi class to solve this problem.
public void InitOcr() { OcrApi.PathToEngine = @"c:\YourApp\tesseract.dll"; using (var api = OcrApi.Create()) { api.Init(); } }