processFields method java example

  • Last Post 28 May 2012
dale posted this 26 May 2012

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("" + 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 ( 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

Vasily Panferov posted this 28 May 2012

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.