Hi Josh,
Thank you for contacting Syncfusion support.
The OCR processor is thread safe and single instance can be shared among the multiple threads. Please refer the below code snippet for more details,
|
string[] files = Directory.GetFiles(@"../../Data");
//Initialize the OCR processor by providing the path of tesseract binaries(SyncfusionTesseract.dll and liblept168.dll)
OCRProcessor processor = new OCRProcessor(@"../../Tesseract Binaries/");
Parallel.For(0, files.Length, (i, loopstate) =>
{
//Load a PDF document
PdfLoadedDocument lDoc = new PdfLoadedDocument(files[i]);
//Set OCR language to process
processor.Settings.Language = Languages.English;
//Process OCR by providing the PDF document and Tesseract data
string str = processor.PerformOCR(lDoc, @"../../Tessdata/", true);
string name = Guid.NewGuid().ToString();
lDoc.Save(name + ".pdf");
lDoc.Close(true);
}); |
Please let us know if you need any further assistance on this.
Regards,
Sowmiya Loganathan