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

PDF OCR throw exception 'Syncfusion.Pdf.PdfException: Exception has been thrown by the target of an invocation.


I am trying to perform ocr a PDF Document using Syncfusion.PDF.OCR.NET with .NET 6 running on windows but it throws the following exception.

Syncfusion.Pdf.PdfException: 'Syncfusion.Pdf.PdfException: Exception has been thrown by the target of an invocation.

   at Syncfusion.OCRProcessor.OCRProcessor.ProcessOCR(String[] args, String[] imagePathList)

   at Syncfusion.OCRProcessor.OCRProcessor.GetHOCR(String imagePath, String dataPath, Boolean multiPageTiff, String[] imagePathList)

   at Syncfusion.OCRProcessor.OCRProcessor.PerformOCR(PdfLoadedDocument lDoc, Int32 startIndex, Int32 endIndex, String dataPath)'

I'm using Syncfusion.PDF.OCR.Net.Core

and this is my code.

            using (var outputPdf = new FileStream(fileOcrFullPath, FileMode.Create, FileAccess.ReadWrite))


                using (var pdfFile = new FileStream(pdfPath, FileMode.Open, FileAccess.Read))


                    using (OCRProcessor processor = new OCRProcessor(@"TesseractBinaries/Windows"))


                        PdfLoadedDocument pdf = new PdfLoadedDocument(pdfFile);

                        processor.Settings.Language = Languages.English;

                        processor.PerformOCR(pdf, @"tessdata/");






I'm using indonesia trained data from tesseract.

Thanks in advance.

3 Replies

SN Santhiya Narayanan Syncfusion Team March 31, 2023 01:40 PM UTC

The reported exception may occurs due to missing or mismatch assemblies of the Tesseract binaries and Tesseract data from OCR processor or the VC++ 2015 redistributable files are missing in the machine, where the OCR processor takes place. So, we need to install the VC++ 2015 redistributable files in your machine.


Please select both vc_redist.x64.exe or x86.exe and install it.



Please find the download link Visual C++ 2015 Redistributable file,


Please find the below documentation page


If still you have facing an error,we request you to share the modified sample,input document to check this on our end.So that it will be helpful for us to analyze and assist you further on this.

MM Mihai Moisei May 6, 2023 08:52 AM UTC

But in error log  of   Visual C++ 2015  appear

[A0AC:4940][2023-05-06T11:49:34]e000: Error 0x80070666: Cannot install a product when a newer version is installed.

SN Santhiya Narayanan Syncfusion Team May 8, 2023 03:04 PM UTC

Could you please copy and paste the below files to this (C:\Windows\SysWOW64) location, try the OCR process, and let us know the result?

VC++ files: https://www.syncfusion.com/downloads/support/directtrac/general/ze/VCPP727121881

Download and extract the files.

Paste the files in the C:\Windows\SysWOW64 folder.

Check out the OCR process.

Please let us know if you need any further assistance in this.

Live Chat Icon For mobile
Up arrow icon