Tesseract OCR error

Hello
i am trying to use syncfusion ocr with tesseract. I have the following error

  using (OCRProcessor processor = new OCRProcessor(@"../../Tesseract Binaries/"))
                {
                    //processor.Settings.TempFolder = @"C:\Temp\TesseractWork\";

                    //Load a PDF document
                    PdfLoadedDocument lDoc = new PdfLoadedDocument("../../Data/input.pdf");

                    //Set OCR language to process
                    processor.Settings.Language = Languages.English;

                    //Process OCR by providing the PDF document and Tesseract data
                    output.Text = processor.PerformOCR(lDoc, @"../../Tessdata/");

                    //Save the OCR processed PDF document in the disk       
                    lDoc.Close(true);
                }

System.Exception
  HResult = 0x80131500
  Message = Unhandled Exception: System.Reflection.TargetInvocationException: Exception thrown by the target of a call. ---> System.AccessViolationException: Attempt to read or write protected memory. Often this condition indicates that other parts of the memory are corrupted.
   in Syncfusion.OCRProcessor.Native.OCRApi.InitializeDataPath (IntPtr pt, String path, String lang)
   in Syncfusion.OCRProcessor.OCRProcessor.DoOCR (String [] args)
   --- End of inner exception stack trace ---
   in System.RuntimeMethodHandle.InvokeMethod (Object target, Object [] arguments, Signature sig, Boolean constructor)
   in System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal (Object obj, Object [] parameters, Object [] arguments)
   in System.Reflection.RuntimeMethodInfo.Invoke (Object obj, BindingFlags invokeAttr, Binder binder, Object [] parameters, CultureInfo culture)
   in Program.Main (String [] args)

  Source = Syncfusion.OCRProcessor.Base
  Stack Trace:
   in Syncfusion.OCRProcessor.OCRProcessor.GetHOCR (String imagePath, String dataPath)
   in Syncfusion.OCRProcessor.OCRProcessor.PerformOCR (PdfLoadedDocument lDoc, Int32 startIndex, Int32 endIndex, String dataPath)
   in Syncfusion.OCRProcessor.OCRProcessor.PerformOCR (PdfLoadedDocument lDoc, String dataPath)
   in aiprivacy_fron.Editor.ASPxCallbackPaneTuttemieprenot_Callback (Object sender, CallbackEventArgsBase e) in C: \ MapWindow4Dev \ SUDE \ 00_SVN_PAESIT \ AI_privacy \ Potenzainlove \ Potenzainlove \ Editor.asp4.cs: line 49
   in DevExpress.Web.ASPxCallbackPanel.OnCallback (CallbackEventArgsBase e)
   in DevExpress.Web.ASPxCallbackPanel.RaiseCallbackEvent (String eventArgument)
   in DevExpress.Web.ASPxWebControl.System.Web.UI.ICallbackEventHandler.RaiseCallbackEvent (String eventArgument)

1 Reply 1 reply marked as answer

GK Gowthamraj Kumar Syncfusion Team April 29, 2021 12:20 PM UTC

Hi Giovanni, 
 
Thank you for contacting Syncfusion support.    
   
The reported exception may occurs due to missing or mismatch assemblies of the Tesseract binaries and Tesseract data from OCR processor. We have created a sample to perform the OCR operation with test document, it is working properly. We were not able to reproduce the reported exception on our end. Please make sure the path of the Tesseract binaries and Tesseract data are provided properly. Kindly please try the below sample in your end and let us know the result.   
    
   
Note: The above sample contains the Tesseract binaries and Tess data folder in a project location.   
   
Please refer the below link for more information,   
   
If still you are facing an same exception, kindly provide more details such as modified sample, complete code snippet, input documents, product version to check the issue in our end. So, that it will be helpful for us to analyze and assist you further on this.    
 
Regards, 
Gowthamraj K 


Marked as answer
Loader.
Up arrow icon