- Home
- Forum
- ASP.NET Web Forms (Classic)
- Tesseract OCR error
Tesseract OCR error
Hello
i am trying to use syncfusion ocr with tesseract. I have the following error
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);
}
{
//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 = 0x80131500Message = 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)
SIGN IN To post a reply.
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,
KB: https://www.syncfusion.com/kb/9144/how-to-convert-scanned-image-to-searchable-pdf-by-processing-ocr
Troubleshooting: https://help.syncfusion.com/file-formats/pdf/working-with-ocr/dot-net-framework#troubleshooting
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
SIGN IN To post a reply.
- 1 Reply
- 2 Participants
- Marked answer
-
GI Giovanni
- Apr 28, 2021 03:15 PM UTC
- Apr 29, 2021 12:20 PM UTC