コミュニティ

processFields method java example

Hi, I love the new processTextField function you guys have added. It is exactaly what I need!! I am however struggling to get the call working. Using Android I have the following code that submits one text field

public Task  processTextField( String filePath, ProcessingSettings settings) throws Exception
{
    URL url = new URL("http://cloud.ocrsdk.com/processTextField?" + settings.AsUrlParams());
    byte[] fileContents = readDataFromFile( filePath );
    HttpURLConnection connection = openPostConnection(url);
    connection.setRequestProperty("Content-Length", Integer.toString(fileContents.length));
    connection.getOutputStream().write( fileContents );
    BufferedReader reader = new BufferedReader( new InputStreamReader( connection.getInputStream()));
    return new Task(reader);
}

settings.AsUrlParams() return the string "language=English&textType=handprinted&oneTextLine=true&oneWordPerTextLine=true&markingType=underlinedText", and filePath is the path to my JPEG file.

Would it be possible to get a code example of how to post the XML file you speak of here (http://ocrsdk.com/documentation/specifications/xml-scheme-field-settings) in Java? So for example you have an image and there are 2 or 3 text fields you want to submit at once.

Thanks Al

この記事は役に立ちましたか?

0人中0人がこの記事が役に立ったと言っています

コメント

1件のコメント

  • Avatar
    SDK Support Team

    Current Java sample is able to call processFields. Try it and see source code for more details.

    Sample xml is available when you download the whole sample archive from github.

    0

サインインしてコメントを残してください。