public async Task ProcessImage_ShouldBeOk() { // Arrange var parameters = new ImageProcessingParams { Language = "English", ExportFormats = new[] { ExportFormat.Docx, }, }; // Act TaskInfo processImageTask; using (var fileStream = GetResourceFileStream(TestFile.Image)) { processImageTask = await ApiClient.ProcessImageAsync( parameters, fileStream, TestFile.Image, true ); } // Assert CheckResultTask(processImageTask); }
public async Task <List <string> > AbbyyRunnerAsync(AuthInfo authInfo, string FilePath) { var client = new OcrClient(authInfo); var imageParams = new ImageProcessingParams { ExportFormats = new[] { ExportFormat.Txt }, Language = "English", ReadBarcodes = true, CorrectOrientation = true, }; var fileStream = new FileStream(FilePath, FileMode.Open); var taskInfo = await client.ProcessImageAsync(imageParams, fileStream, Path.GetFileName(FilePath), waitTaskFinished : true); return(taskInfo.ResultUrls); }
/// <inheritdoc /> public Task <TaskInfo> ProcessImageAsync( ImageProcessingParams parameters, Stream fileStream, string fileName, bool waitTaskFinished = false, CancellationToken cancellationToken = default) { return(StartTaskAsync( HttpMethod.Post, Urls.Ocr.ProcessImage, parameters, fileStream, fileName, waitTaskFinished, cancellationToken)); }
private static async Task <List <string> > ProcessImageAsync(IOcrClient ocrClient, string localFile) { var imageParams = new ImageProcessingParams { ExportFormats = new[] { ExportFormat.Docx, ExportFormat.Txt, }, Language = "English,Arabic,Hebrew", }; using (var fileStream = new FileStream(localFile, FileMode.Open)) { var taskInfo = await ocrClient.ProcessImageAsync( imageParams, fileStream, Path.GetFileName(localFile), waitTaskFinished : true); return(taskInfo.ResultUrls); } }
private static async Task <List <string> > ProcessImageAsync(IOcrClient ocrClient) { var imageParams = new ImageProcessingParams { ExportFormats = new[] { ExportFormat.Docx, ExportFormat.Txt, }, Language = "English,French", }; const string filePath = "New Image.jpg"; using (var fileStream = new FileStream(filePath, FileMode.Open)) { var taskInfo = await ocrClient.ProcessImageAsync( imageParams, fileStream, Path.GetFileName(filePath), waitTaskFinished : true); return(taskInfo.ResultUrls); } }