static void RecognizePdf2SearchableFromContent(Configuration conf) { string name = "TheCall.pdf"; using (FileStream fs = File.OpenRead(name)) { OcrApi api = new OcrApi(conf); var request = new OCRRequestData() { DsrMode = DsrMode.NoDsrNoFilter, ResultType = ResultType.Pdf, Language = LanguageEnum.Arabic }; OCRPDFResponse response = api.OcrPdfFromContent(request, fs); File.WriteAllBytes(@"result.pdf", Convert.FromBase64String(response.ResultData[0].ImageOcrResults.First().ResultPdf)); } }
static string RecognizePdfFromContent(Configuration conf) { string name = "TheCall.pdf"; using (FileStream fs = File.OpenRead(name)) { OcrApi api = new OcrApi(conf); var request = new OCRRequestData() { DsrMode = DsrMode.NoDsrNoFilter }; OCRPDFResponse response = api.OcrPdfFromContent(request, fs); var all_text = response.ResultData.Aggregate( "", (s, page) => s += page.OriginalText + "\n\n" + page.ImageOcrResults.Aggregate("", (s1, singleImageResult) => s1 += singleImageResult.ResultText + "\n\n") + "\n\n"); return(all_text); } }