Free Support Forum - aspose.com

Bug in nuget-OCR-Version 19.8.0 and 19.8.1

I just upgraded my Aspose.OCR-nuget-package from version 17.11.0 to 19.8.1, which broke the following code at “ocrEngine.Process()”:

Aspose.Pdf.License licPDF = new Aspose.Pdf.License();
licPDF.SetLicense("Aspose.Total.lic");
Aspose.Pdf.Document pdfDoc = null;

Aspose.OCR.License licOCR = new Aspose.OCR.License();
licOCR.SetLicense("Aspose.Total.lic");
Aspose.OCR.OcrEngine ocrEngine = new Aspose.OCR.OcrEngine();

using (var ms = new MemoryStream(File.ReadAllBytes(Path.Combine("pathToDocument", "Beispiel3.pdf"))))
{
    pdfDoc = new Aspose.Pdf.Document(ms);
    if (pdfDoc != null)
    {
        var sb = new StringBuilder();
        foreach (var page in pdfDoc.Pages)
        {
            using (var imageStream = new MemoryStream())
            {
                var jpegDevice = new Aspose.Pdf.Devices.JpegDevice(new Aspose.Pdf.Devices.Resolution(300), 100);
                jpegDevice.Process(page, imageStream);
                imageStream.Position = 0;
                ocrEngine.Image = Aspose.OCR.ImageStream.FromStream(imageStream, ImageStreamFormat.Jpg);
                if (ocrEngine.Process())
                {
                    Console.WriteLine(ocrEngine.Text);
                }
            }
        }
    }
}

The error states:

MyNamespace.UnitTest.AsposeTest_OCR_PDF_to_TXT.Test_AsposeOCR_PDFToText:
Aspose.OCR.OcrException : Error occurred during recognition.
----> System.IO.FileNotFoundException : The file “pathToMyProject\UnitTest\bin\Debug\data” does not exist.

StackTrace:
at Aspose.OCR.OcrEngine. ()
at Aspose.OCR.OcrEngine.Process()
at MyNamespace.UnitTest.AsposeTest_OCR_PDF_to_TXT.Test_AsposeOCR_PDFToText() in pathToMyProject\UnitTest\AsposeTest_OCR_PDF_to_TXT.cs: line 74.
–FileNotFoundException
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.File.GetAttributes(String path)
at .(String , String )
at .(IEnumerable1 ) at ..ctor(IEnumerable1 )
at …ctor()
at …ctor()
at …ctor( , Boolean )
at .( , Boolean )
at Aspose.OCR.OcrEngine.()

Testing the nuget-version 19.8.0 replicates the same error.

Please find the pdf-file attached:
Beispiel3.pdf (70.6 KB)

Best regards.

@M.Heinz

We have tested the scenario in our environment and were able to replicate the issue. We have logged it as OCR-797 in our issue tracking system for further investigation. We will look into details of the issue and keep you posted with the status of its correction. Please be patient and spare us little time.

We are sorry for the inconvenience.

experiencing the same issue… Can this be expedited please?

Also in current build 19.9.0

@rozeboosje

We have recorded your concerns along with the logged issue and will definitely keep you posted on the status of its resolution. Please spare us a little time.

We are sorry for the inconvenience.

Is there any workaround for this? Any code sample on how to use a Build 19.9 Aspose.OCR successfully?

While M.Heinz is trying to OCR a PDF, I am trying to OCR image files such as JPG and PNG files. But it does the exact same thing as what M.Heinz is reporting; it’s coming up with the exact same error. Like M.Heinz my code works fine with Build 17.11, but I cannot find a way to make build 19.9 work at all. I note that it has already taken 2 months since M.Heinz reported this, and I would be very unpleasantly surprised if you had left a completely non-functional product in public release for that long. So I am assuming that this was released on the basis of it working in some scenarios, and it would be helpful if you could find some way of making the current software work… and share it with us poor unfortunates :smile:

@rozeboosje

Please accept our humble apologies for the inconvenience which has been faced. Please note that the issue is already being investigated and we are trying our best to resolve it as soon as possible. Further releases of the API have also been pending because of this scenario as this is taking time to get resolved.

We will definitely consider your concerns and will surely let you know as soon as we have some definite updates regarding resolution of the ticket or any available workaround. We greatly appreciate your patience and comprehension in this matter. Please spare us little time.

We are sorry for the inconvenience.

Iirc I also tried to OCR an image file, as this is an other application in our software - having the same issues. But having an identical error message and stack trace, I did assume the underlying issue to be the same and therefore didn’t think of reporting this issue as well.

1 Like

@M.Heinz

We are in process to resolve this issue and hopefully we will be updating you soon about it fix. We really apologize for the inconvenience which has been faced.

1 Like