We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

OCRProcessor.PerformOCR cancel OCR

How to control OCRProcessor.PerformOCR method timeout or cancel OCR itself whenTesseract engine is used? I can kill the running thread but I find that OCRProcessor.PerformOCRlaunches another process with the extension .tmp which is not killed when I abort C# thread where OCRProcessor running.

3 Replies

SL Sowmiya Loganathan Syncfusion Team November 26, 2019 06:56 AM

Hi Marek, 

Thank you for contacting Syncfusion support.  

We have analyzed your requirement. When tried to kill the running thread of OCR with Tesseract version 3.02, it will not kill the another process of OCRProcessor.PerformOCRlaunches with extension .tmp. However we can achieve your requirement by using Tesseract 3.05 version with enabling of “EnableNativeCall” property in 64-bit binaries (This 64-bit binaries should require when the native call property is enabled). Please find the X64 bit supporting tesseract binaries download link from below, 

While performing OCR with this settings, it will not create the another process as like the above. Please refer the below code snippet for more details, 

//Load a PDF document 
PdfLoadedDocument lDoc = new PdfLoadedDocument("input.pdf"); 
 
//Set OCR language to process 
processor.Settings.Language = Languages.English; 
 
//Set tesseract OCR version  
processor.Settings.TesseractVersion = TesseractVersion.Version3_05; 
 
//Enable native call  
processor.Settings.EnableNativeCall = true; 
 
//Process OCR by providing the PDF document and Tesseract data 
string str = processor.PerformOCR(lDoc, @"Tessdata/", true); 

Please refer the below UG documentation link for more details, 

Kindly try the above solution in your end and let us knw the result.  

Regards, 
Sowmiya Loganathan 



MO Marek Opanas December 16, 2019 09:18 AM

Thank you. You could improve your library by adding the Cancel() method and the library would take care of canceling OCR. Just suggestion.


SL Sowmiya Loganathan Syncfusion Team December 17, 2019 07:00 AM

Hi Marek, 

Thank you for the suggestion. We will consider this.  

Regards, 
Sowmiya Loganathan 


Loader.
Live Chat Icon For mobile
Up arrow icon