Still alwayas problem!! :Integrate ABBYY code in my applciatin C#

  • 727 Views
  • Last Post 30 June 2016
thabet idris posted this 27 June 2016

I have tested with OCR ABBY using sample code C# with sucess , but with the command :

ConsoleTest.exe --asMRZ C:\image.jpg C:\ (the result is file image.xml)

I want to integrate in my code C#, with function ProcessMRZ.

I do these steps:

1)I added two references: AbbyyOnlineSdk and NDesk.Options 2) I add namespace: using Abbyy.CloudOcrSdk;

3)I declare RESTClient: private Rest serviceclient RESTClient;

4)I called to the Test () function, with my infos details: name of my application and password

5)Now I want to apply asMRZ: Process Mrz, I call restClient.Process Mrz (@ "C: \ temp \ image.jpg"); Unfortunately, I have not the result ... I always ERROR!

Is Step 5) to call MRZ Process correct ? or how I should change it?

I also tried with: Process Mrz (@ "C: \ temp \ image.jpg" @ "C: \ temp \"); I have always not the result !!

Thanks

Order By: Standard | Newest | Votes
Oksana Serdyuk posted this 27 June 2016

We need some additional information from you to investigate the issue:

1) Kindly send us your project and step-by-step instruction how to run your application and reproduce the issue.

2) Please send us the logs from any HTTP debugger (such as Fiddler). We need to know what requests do you send to the server).

thabet idris posted this 27 June 2016

Thanks,

This is my TRY project ABBYY C#:

link text

Oksana Serdyuk posted this 28 June 2016

I do not see in your code that you create and send any request to the service. In your case it should be:

[POST] http(s)://cloud.ocrsdk.com/processMRZ

and the input image file should be transmitted in the request body.

I would recommend you to re-read

thabet idris posted this 28 June 2016

Very thanks,

I make the code for C#:

String url = "http://cloud.ocrsdk.com/processImage?Language=English,Russian"; WebRequest request = WebRequest.Create(url);

        String toEncode = ApplicationID + ":" + ApplicationPassword;
        Encoding isoEncoding = Encoding.GetEncoding("iso-8859-1");
        String isoEncoded = Encoding.GetBytes(toEncode);

        String baseEncoded = Convert.ToBase64String(isoEncoded);

        request.Headers.Add("Authorization", "Basic " + baseEncoded);

I have ERROR with Encoding.GetBytes(toEncode); Exist any using to add?

And please for i decise my input file : "http://cloud.ocrsdk.com/processImage?imageSource=...? How i precise my source, if it is in my PC or photo with scanner? Can you give mme a exemple please,

My photo is locate in C:\temp\

Oksana Serdyuk posted this 30 June 2016

There are some misprints in the code snippet in the Authentication section. Please do the following:

Encoding encoding = Encoding.GetEncoding("iso-8859-1");
string toEncode = ApplicationID + ":" + ApplicationPassword;
string baseEncoded = Convert.ToBase64String(encoding.GetBytes(toEncode));
request.Headers.Add( "Authorization", "Basic " + baseEncoded );

We have already corrected the documentation and we apologize for all possible inconvenience.

As for your question about the imageSource parameter, it is optional parameter and you can miss it. By default the value is auto and it means that the program will detect the image source automatically. But if you need to choose the source image you can allow the users of your application to make the choice themselves by implementing this possibility in the interface of your application.

thabet idris posted this 30 June 2016

It is good Now it is correct Very thanks..

Close