private void DoOcr(string pdffile) { // get filename string filename = System.IO.Path.GetFileNameWithoutExtension(pdffile); OCR ocr = new OCR(); i += 1; List <string> imgs = new List <string>(ocr.PDFToImage(pdffile)); Invoke((Action) delegate { circleProgressbar.Value = (int)(i / (double)_files.Count * 50); //animatepanel.Refresh(); }); pdfData[filename] = ocr.v3_GetContents(imgs).ToString(); i += 1; Invoke((Action) delegate { circleProgressbar.Value = (int)(i / (double)_files.Count * 50); //Console.WriteLine(i ); if (i + 1 - _files.Count > 0) { labelf.Text = " Reading Content " + (i + 1 - _files.Count) + " of " + _files.Count; } //animatepanel.Refresh(); if (i + 1 == _files.Count) { circleProgressbar.Value = 98; } }); }
private Task <StringBuilder> DolazyOcr(string pdffile) { // make an ocr instance and call it on a tread to getcontent OCR ocr = new OCR(); //start ocring with a new task return(Task.Run(() => { List <string> imgs = new List <string>(ocr.PDFToImage(pdffile)); this.Invoke((Action) delegate { feed_label.Text = "PW Getting text ..."; } ); return ocr.v3_GetContents(imgs); })); }