PowerShell Error - OCR Engine

Good morning. I’m using PowerShell to run Aspose.OCR based on the sample C# code you provide. My code:

#Load Aspose OCR for .NET DLL
#[System.Reflection.Assembly]::LoadFrom(“C:\Program Files (x86)\Aspose\Aspose.OCR for .NET\Bin\net3.5\Aspose.OCR.dll”)
Add-Type -Path “C:\Program Files (x86)\Aspose\Aspose.OCR for .NET\Bin\net3.5\Aspose.OCR.dll”

#Load Aspose OCR License File
$OCRLicense = New-Object Aspose.OCR.License
$OCRLicense.SetLicense(“V:\DFAS\Travel Pay TPS\Aspose\Aspose.OCR.lic”)
$OCREngine = New-Object Aspose.OCR.OcrEngine
$OCREngine.Image = [Aspose.OCR.ImageStream]::FromFile(‘V:\DFAS\Travel Pay TPS\Aspose\PDF\test.jpg’)


I get this error:

The result type ‘System.Boolean’ of the dynamic binding produced by binder ‘PSInvokeMember: Process ver:0 args:0 constraints:<>’ is not compatible
with the result type ‘System.Object’ expected by the call site.
At V:\DFAS\Travel Pay TPS\Aspose\test.ps1:61 char:1

  • [Aspose.OCR.OcrEngine]$OCREngine.Process()
  •   + CategoryInfo          : OperationStopped: (:) [], InvalidCastException
      + FullyQualifiedErrorId : System.InvalidCastException


thanks, Mike


Please test your code under Visual Studio. In case the issue persists, forward us the details along with sample project and input file. We will look into it and update you about our findings.