public void SaveOCRBlob(OcrAttchmentModel ocrAttModel, string fileName, Byte[] sbytes, bool isNotPdf = false)
 {
     using (var client = new HttpClient())
     {
         string ApiKey  = ConfigurationManager.AppSettings["ApiKey"];
         string baseUrl = ConfigurationManager.AppSettings["BaseUrl"];
         client.BaseAddress = new Uri(baseUrl);
         client.DefaultRequestHeaders.Clear();
         client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
         client.DefaultRequestHeaders.TryAddWithoutValidation("Content-Type", "application/json");
         client.DefaultRequestHeaders.TryAddWithoutValidation("ApiKey", ApiKey);
         LogUtility.WriteToFile("OCR Process Request PayLoad Header:" + client.DefaultRequestHeaders);
         //HTTP POST
         OcrBlobModel ocrBlobModel = new OcrBlobModel();
         ocrBlobModel.ridAttachment = Convert.ToInt32(ocrAttModel.ridAttachment);
         ocrBlobModel.contents      = isNotPdf == true ? new TextExtractor().Extract(sbytes).Text : Encoding.UTF8.GetString(sbytes, 0, sbytes.Length);
         string strPayload = JsonConvert.SerializeObject(ocrBlobModel);
         LogUtility.WriteToFile("OCR Process Request PayLoad:" + strPayload);
         HttpContent c     = new StringContent(strPayload, Encoding.UTF8, "application/json");
         string      path1 = client.BaseAddress + "Attachment/CreateOCREntry";
         //ConfigurationManager.AppSettings["CreateOCR"];
         HttpResponseMessage response = client.PostAsync(path1, c).Result;
         LogUtility.WriteToFile("OCR Process Response:" + response);
     }
 }
 public void SaveOCRWithoutContent(OcrAttchmentModel ocrAttModel)
 {
     using (var client = new HttpClient())
     {
         string ApiKey  = ConfigurationManager.AppSettings["ApiKey"];
         string baseUrl = ConfigurationManager.AppSettings["BaseUrl"];
         client.BaseAddress = new Uri(baseUrl);
         client.DefaultRequestHeaders.Clear();
         client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
         client.DefaultRequestHeaders.TryAddWithoutValidation("Content-Type", "application/json");
         client.DefaultRequestHeaders.TryAddWithoutValidation("ApiKey", ApiKey);
         //HTTP POST
         OcrBlobModel ocrBlobModel = new OcrBlobModel();
         ocrBlobModel.ridAttachment = Convert.ToInt32(ocrAttModel.ridAttachment);
         ocrBlobModel.contents      = " ";
         string      strPayload = JsonConvert.SerializeObject(ocrBlobModel);
         HttpContent c          = new StringContent(strPayload, Encoding.UTF8, "application/json");
         string      path1      = client.BaseAddress + "Attachment/CreateOCREntry";
         //ConfigurationManager.AppSettings["CreateOCR"];
         HttpResponseMessage response = client.PostAsync(path1, c).Result;
     }
 }