Reputation: 343
I am creating a console application using Tesseract 5.2.0
below is my code for the same.
System.Drawing.Bitmap img = new System.Drawing.Bitmap(convertedFile);
//TesseractEngine engine = new TesseractEngine(convertedFile, "eng", EngineMode.Default);
var path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().CodeBase);
path = Path.Combine(path, "tessdata");
path = path.Replace("file:\\", "");
using (var engine = new TesseractEngine(path, "eng", EngineMode.Default))
{
engine.SetVariable("tessedit_char_whitelist", "1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ");
engine.SetVariable("tessedit_unrej_any_wd", true);
using (var page = engine.Process(img, PageSegMode.Auto))
strTextData = page.GetText();
}
on var engine = new TesseractEngine(path, "eng", EngineMode.Default)
line I am getting the error of
Exception has been thrown by the target of an invocation.
and in inner exception it reads as
Failed to find library "leptonica-1.80.0.dll" for platform x64.
and the problem is when I downloaded Tesseract 5.2.0 "leptonica-1.82.0.dll" gets downloaded alongside Tesseract and Tesseract is expecting "leptonica-1.8.0.dll"
what can be done here as I already Installed VC_redist.x64 in my machine.
Upvotes: 5
Views: 1592