Unhandled exception while performing OCR operation on scanned PDF

could you please provide the access to download the zip file, presently while am trying to download giving the below error:

Sorry, this file is private. Only visible to topic owner and staff members.


This Topic is created by asad.ali using Email to Topic tool.

@surya.parim

Please try to download the sample application from below attached resource. In case you still face issue in downloading the file, please let us know.
OCRTestApp.zip (9.0 MB)

Hi Ali,

Thanks for the update still getting the below exception , could you able to help on
this, using the Aspose.OCR version : Aspose.OCR 25.7.0

Exception detail:
Unhandled exception. System.TypeInitializationException: The type initializer for ‘Microsoft.ML.OnnxRuntime.NativeMethods’ threw an exception.

—> System.DllNotFoundException: Unable to load DLL ‘onnxruntime’ or one of its dependencies: A dynamic link library (DLL) initialization routine failed. (0x8007045A)

at Microsoft.ML.OnnxRuntime.NativeMethods.OrtGetApiBase()

at Microsoft.ML.OnnxRuntime.NativeMethods…cctor()

— End of inner exception stack trace —

at Microsoft.ML.OnnxRuntime.SessionOptions…ctor()

at .()

at ..()

at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)

at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)

at System.Lazy`1.CreateValue()

at .(DetectAreasMode , Func`1 )

at .(DetectAreasMode )

at …ctor(RecognitionSettings ,  ,  )

at Aspose.OCR.AsposeOcr.Recognize(OcrInput images, RecognitionSettings settings)

at Aspose.OCR.AsposeOcr.Recognize(OcrInput images)

using .NET 8 and the same code is working in personal laptops but not on Organizational work stations

@surya.parim

Looks like the issue is related to the specific environment. Can you please share complete details of the environment e.g. OS Name and Version, Application Type, Target Framework Version, Architecture, etc. We will further proceed accordingly.

Right now trying with a simple console application.

OS : WINDOWS 10 Enterprise
Application Type : Desktop
Target Framework : .NET 8

@surya.parim

Looks like there is an issue related to dependency resolution for ONNX Runtime library. Please verify if correct version is installed and present in the solution. You can also explore this forum thread where similar discussion happened. In case you are still unable to resolve the dependency issue, please let us know.

1 Like