We are testing ABBYY Cloud OCR API, with demo images and some of our test documents using a trial account. In sample code and documentation we observed that once processing request is submitted to ABBYY server, the code is expected to wait at least for 2 seconds before we request for task status, or else "Invalid Task" exception is thrown.
But we found this behavior inconsistent where, for slightly larger document (14 pages) even 5 seconds wait was not enough. Could you let us know, what should be the best way to deal with this?
Also, we would like to know what will be wait times(for tasks) in production/paid version? Will it be same or less? Is overall document processing faster in production compared to trial environment? If yes, how much faster?
sample code we used:
// initialize abbyy client RestClient restClient = new RestClient(); restClient.serverUrl = abbyyServerURL; restClient.applicationId = appId; restClient.password = password; ProcessingSettings.OutputFormat outputFormat = outputFormatByFileExt(outputFile); // prepare settings object for processing ProcessingSettings settings = new ProcessingSettings(); settings.setLanguage(recognitionLang); settings.setOutputFormat(outputFormat); Task task = null; System.out.println("Uploading file... " + inputFile); task = restClient.processImage(inputFile, settings); System.out.println("Got task Id: " + task.Id); Thread.sleep(5000); task = restClient.processDocument(task.Id, settings); waitAndDownloadResult(task, outputFile, restClient);