Example #1
0
        public virtual async Task <string> Exctract(string filePath, int page)
        {
            Console.WriteLine($"Trying Cognitive page {page} from file {filePath}");
            var initialDate = DateTime.Now;
            var imagePath   = await _fileManager.GeneratePageInImage(filePath, page).ConfigureAwait(false);

            var text = await Get(imagePath).ConfigureAwait(false);

            _fileManager.Delete(imagePath);
            Console.WriteLine($"Success Cognitive page {page} from file {filePath} on {DateTime.Now.Subtract(initialDate).Seconds}s");
            return(text);
        }
Example #2
0
        public virtual async Task <string> Exctract(string filePath, int page)
        {
            Console.WriteLine($"Trying PdfToText page {page} from {filePath}");
            var initialDate = DateTime.Now;
            var pagePath    = await _fileManager.GeneratePage(filePath, page).ConfigureAwait(false);

            var text = await Get(pagePath).ConfigureAwait(false);

            _fileManager.Delete(pagePath);
            if (string.IsNullOrEmpty(text) || text.Length < NumberMinOfCharacters)
            {
                return(null);
            }
            Console.WriteLine($"Success PdfToText page {page} from {filePath} on {DateTime.Now.Subtract(initialDate).Seconds}s");
            return(text);
        }