Leadtools - OcrException - ocr Not included

I am using OCR from Leadtools

I have referenced the following DLLS:

Leadtools.dll
Leadtools.Barcode.oneD.dll
Leadtools.codecs.dll
Leadtools.codecs.fax.dll
Leadtools.codecs.png.dll
Leadtools.codecs.tif.dll
Leadtools.Forms.DocumentWriters.dll
Leadtools.forms.ocr.dll
Leadtools.forms.ocr.Advantage.dll

      

And the following code to convert Png file to Pdf

private void button1_Click(object sender, EventArgs e)
{

    try
    {

        string sourceFile = @"C:\Users\cf\Desktop\OcrTest\Images\Capture.PNG";
        string targetFile = Path.ChangeExtension(sourceFile, "pdf");

        using (IOcrEngine ocrEngine = OcrEngineManager.CreateEngine(OcrEngineType.Advantage, false))
        {
            ocrEngine.Startup(null, null, null, @"C:\LEADTOOLS 19\Bin\Common\OcrAdvantageRuntime");
            ocrEngine.AutoRecognizeManager.Run(sourceFile, targetFile, Leadtools.Forms.DocumentWriters.DocumentFormat.Pdf, null, null);
            Process.Start(targetFile);

        }
    }

    catch (OcrSupportLockedException ex)
    {
        Console.WriteLine("Support is locked. You need to unlock '{0}' in this engine to use this feature", ex.SupportType);
    }
    catch (OcrException ex)
    {
        Console.WriteLine("OCR Error\nCode: {0}\nMessage:{1}", ex.Code, ex.Message);
    }
    catch (RasterException ex)
    {
        Console.WriteLine("LEADTOOLS Error\nCode: {0}\nMessage:{1}", ex.Code, ex.Message);
    }
    catch (Exception ex)
    {
        Console.WriteLine("System Error\nMessage:{0}", ex.Message);
    }


}

      

The next line returns OcrException

Ocr Not Enabled

      

With code: -1760

I cannot understand why this is happening

Any help would be appreciated

+3


source to share


1 answer


The -1760 "OCR not enabled" error is most likely caused by an attempt to use one of the LEADTOOLS OCR modules without a corresponding license file or unlock key. You can check before using CreateEngine () by calling RasterSupport.IsLocked (RasterSupportType.OcrAdvantage). If the function returns TRUE, which means Locked, you shouldn't try to use OCR functions.

To use OCR, you either need to have a valid OCR-enabled toolkit license, such as LEADTOOLS Document Imaging Suite, or have a valid free evaluation license.



The mechanism for enabling OCR functions depends on the toolkit version. If you already have a valid unlock key (v17 and earlier) or a valid license file (version 17.5 and later), but it still fails, please send this license / unlock information to support@leadtools.com as you must not post such data on a public forum.

If you do not have this information, please send your toolbox serial number to sales@leadtools.com (also don't post it here!). You can also use our online chat service during business hours to contact customer support or sales.

+2


source







All Articles