Community

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

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

0

Comments

6 comments

  • Avatar
    Oksana Serdyuk

    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).

    0
  • Avatar
    thabet idris

    Thanks,

    This is my TRY project ABBYY C#:

    link text

    0
  • Avatar
    Oksana Serdyuk

    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

    0
  • Avatar
    thabet idris

    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\

    0
  • Avatar
    Oksana Serdyuk

    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.

    0
  • Avatar
    thabet idris

    It is good Now it is correct Very thanks..

    0

Please sign in to leave a comment.