static string RecognizeTableFromContent(Configuration conf) { string name = "table.png"; using (FileStream fs = File.OpenRead(name)) { OcrApi api = new OcrApi(conf); var request = new OCRTableRequestData() { MakeSkewCorrect = true }; OCRTableResponse response = api.OcrTableFromContent(request, fs); //response.Excel, response.CSV return(response.Text); } }
static string RecognizeTableFromStorage(Configuration conf) { string name = "table.png"; using (FileStream fs = File.OpenRead(name)) { OcrApi api = new OcrApi(conf); FileApi fileApi = new FileApi(conf /* or AppSid & AppKey*/); fileApi.UploadFile(new UploadFileRequest(name, System.IO.File.OpenRead(name))); OCRTableRequestDataStorage requestData = new OCRTableRequestDataStorage() { FileName = name, MakeSkewCorrect = true }; OCRTableResponse response = api.OcrTableFromContent(requestData, fs); //response.Excel, response.CSV return(response.Text); } }