public string Process( string imagePath, ProcessingSettings settings )
{
string result = null;
setProgress( 5 );
setStep( "Uploading image..." );
OcrSdkTask task = restClient.ProcessImage(imagePath, settings);
setProgress( 70 );
setStep("Processing...");
task = waitForTask(task);
if (task.Status == TaskStatus.Completed)
{
Console.WriteLine("Processing completed.");
result = restClient.DownloadUrl(task.DownloadUrls[0]);
setStep("Download completed.");
}
else if (task.Status == TaskStatus.NotEnoughCredits)
{
throw new Exception("Not enough credits to process the file. Please add more pages to your application balance.");
}
else
{
throw new Exception("Error while processing the task");
}
setProgress( 100 );
return result;
}