HI team,
We are using .net 6 core and syncfusion.pdf.ocr.net.core 21.2.3 .
it is throwing exception when executing this line of code
var ocrText = processor.PerformOCR(memStream, tessData_Path);
We have tessdata and Tesseract binaries in correct path.
i followed the below post as well still issue not resolved.
can you resolve the issue please.
Thanks,
Dayakar.
Hi Dayakar,
Thank you for reaching out to Syncfusion support.
We have checked the reported issue on our end and it's working well. We suspect the reported issue may occur due to the missing or mismatched assemblies of Tesseract and tessdata in the runtimes folder. While using the OCR, automatically copies the tesseract assemblies in a runtime folder, and the default assemblies path reference is added in the package itself. you can find the binaries in your project location bin\Debug\netcoreapp3.1\runtimes\. However, we have attached the ASP NET core sample with a manual data path for your reference.
Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/OCR-Asp-Net-Core-1536289315
Kindly try the sample and let us know the result. If the issue persists, we kindly request you to share the complete code snippet, and environment details (such as OS, RAM, bit version, and culture settings) with us to replicate the same issue on our end. This will be more helpful for us to analyze and provide a prompt solution.
Regards,
Karmegam
Hello, when deploying it to Azure App Service I am getting following
Exception has been thrown by the target of an invocation. Failed to find library
The DLL/ binaries are included in the bin/ release folders and it works fine locally.
Any idea what could it be?
Hi Ali,
Thank you for reaching out to Syncfusion support.
We have checked the reported issue on our end. The reported issue occurred due to not copying the tessdata assemblies into the Azure environment because, in the latest .NET versions, only the .so, .dly, and .dll files are copied from the runtimes and native folders to the publish folder. The other format files will not be copied to the publish folder, so we have to explicitly copy and set the tessdata folder path from the project directory. Please refer to the screenshot below. However, we have attached a sample for your reference.
Kindly try the provided sample and let us know the result.
Regards,
Karmegam
I am not sure how to provide sample as it works fine locally. I have tried above but it is reporting the same.
Exception has been thrown by the target of an invocation. Failed to find library
BTW the app targets Dotnet 6 .
Do you think it could be that we have a mismatch of these files
We are unable to reproduce the reported issue on our end. We can check if the tessdata and Tesseract binaries are properly copied on the Azure environment by using the ls command in the Azure console. Please find the attached screenshot for your reference.
Screenshot 1:
Screenshot 2:
Screenshot 3:
Please confirm that the assemblies have been copied accurately and notify us of the results. If they have not been copied correctly, please ensure proper copying and provide the accurate tessdata and tesseract path in the OCRProcessor class.
Here are binaries:
The tess data is in a different location
Does it needs to be in the same directory? We are providing the path respectively...
It is not necessary to include the tessdata path in the same directory. However, the paths must be specified in TessDataPath and TesseractPath in the OCRProcessor class accordingly.
Kindly provide the correct path and let us know the result. If you are still facing issues, we kindly request you to share the modified sample, input documents, package name, package version, and environment details (such as OS, bit version, RAM size, and culture settings) with us to replicate the same issue on our end. It will be more helpful for us to analyze and provide you with a prompt solution.