Nuget package version for Windows Server 2019

I was able to get Aspose.OCR v 20.12.1 to work, but it uses older methods. I’ve tried the newest version (v 25.9.1) and it gives me a ‘access violation’ error. I’m trying to do Recognize using a bitmap over a memory stream.

@tfid

It seems you’re experiencing an ‘access violation’ error when using Aspose.OCR version 25.9.1 with a bitmap over a memory stream. This issue may be related to compatibility or changes in the API between versions.

To troubleshoot this, I recommend the following steps:

  1. Check for Updates: Ensure that you are using the latest version of Aspose.OCR. Newer versions often fix bugs present in previous releases.

  2. Review Documentation: Look for any breaking changes or updated methods in the release notes for version 25.9.1. This can help you adjust your code accordingly.

  3. Sample Code: Here’s a basic example of how to use Aspose.OCR with a bitmap from a memory stream:

    using Aspose.Ocr;
    using System.Drawing;
    using System.IO;
    
    public void RecognizeTextFromBitmap()
    {
        using (MemoryStream memoryStream = new MemoryStream())
        {
            // Load your bitmap image into the memory stream
            Bitmap bitmap = new Bitmap("path_to_your_image.png");
            bitmap.Save(memoryStream, System.Drawing.Imaging.ImageFormat.Png);
            memoryStream.Position = 0;
    
            // Create an instance of the OcrEngine
            OcrEngine ocrEngine = new OcrEngine();
    
            // Load the image from the memory stream
            using (var imageStream = new MemoryStream(memoryStream.ToArray()))
            {
                ocrEngine.Image = ImageStream.FromStream(imageStream);
                if (ocrEngine.Process())
                {
                    string recognizedText = ocrEngine.Text.ToString();
                    Console.WriteLine(recognizedText);
                }
            }
        }
    }
    
  4. Contact Support: If the issue persists, consider reaching out to Aspose support for assistance, as they can provide more specific guidance based on your environment and usage.

For further assistance, refer to the official Aspose documentation and community forums for any similar issues reported by other users.

This seems like an AI response. The sample code doesn’t help. I did all that (except the bogus code). Now I’m at step 4 - contact support. So I ask again - What Nuget package version do I need to use for Window server 2019?

@tfid

Please make sure that your project targets .NET Framework 4.6.1 or higher and use below code sample with the latest version of the API:

Aspose.OCR.AsposeOcr recognitionEngine = new Aspose.OCR.AsposeOcr();
Aspose.OCR.OcrInput input = new Aspose.OCR.OcrInput(Aspose.OCR.InputType.SingleImage);
input.Add(dataDir + "sample.bmp");
// Set recognition language
Aspose.OCR.RecognitionSettings recognitionSettings = new Aspose.OCR.RecognitionSettings();
recognitionSettings.Language = Aspose.OCR.Language.Eng;
// Recognize image
var results = recognitionEngine.Recognize(input, recognitionSettings);
Aspose.OCR.AsposeOcr.SaveMultipageDocument(dataDir + "output.pdf", Aspose.OCR.SaveFormat.Pdf, results);

In case you still face any issues, please feel free to let us know. We will further proceed to assist you accordingly.

I was able to use Aspose.OCR v25.4.0, but not the most recent v25.9.1. At least the one that works for me uses the same methods (functions) as the most recent one so I can use the features that it provides. My app is written for .net framework 4.7.2.

@tfid

Can you please share what kind of issues you faced with the latest available version of the API? We will investigate and address them accordingly.

My setup is:
Windows server 2019 Pro (Essentials)
Visual Studio 2019 v. 16.11.52 .net framework 4.7.2
Aspose.OCR nuget package v. 25.4.0 w/ Lowest Dependency behavior and OnnxRuntime v. 1.20.1
This config works.

When I try to go to Aspose.OCR nuget package v. 25.6.0 that updates OnnxRuntime from 1.20.1 to 1.22.0, it does not work.

I get the error “The type initializer for ‘Microsoft.ML.OnnxRuntime.NativeMethods’ threw an exception”

@tfid

We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): OCRNET-1128

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.