Example #1
0
        public PdfsController(String text, int caseNumber, int evidenceNumber)  //called on create post
        {
            var service           = new TesseractService(@"C:\Users\cjani\OneDrive\Documents\GitHub\TesseractLocal", "eng", @"C:\Users\cjani\OneDrive\Documents\GitHub\TesseractLocal\tessdata");
            var varCipher         = new CeaserCipher();   //decrypt module
            var varTranslation    = new Translation();    //translate module
            var varTransformation = new Transformation(); //transformation module

            //MigraDoc
            varTransformation.ConvertToPdf3(varTranslation.TranslateText(varCipher.Decrypt(service.GetText(System.IO.File.OpenRead(text)))), caseNumber, evidenceNumber);
            var varPushover = new Pushover(caseNumber, evidenceNumber);


            //PDFSharp - less features but same company as MigraDoc
            //varTransformation.ConvertToPdf2(varTranslation.TranslateText(varCipher.Decrypt(service.GetText(System.IO.File.OpenRead(text)))), caseNumber, evidenceNumber);

            //Select.PDF.Core - deprecated (for this program) due to cost restraints
            //varTransformation.ConvertToPdf(varTranslation.TranslateText(varCipher.Decrypt(service.GetText(System.IO.File.OpenRead(text)))), caseNumber, evidenceNumber);

            //A little easier to read but most be covnerted to the above text due to an enclosed local variable
            //string path = @"C:\TempFolder\CipherText.png";
            //FileStream stream = System.IO.File.OpenRead(path);

            ////@"C:\TempFolder\CipherText.png";
            //string text = service.GetText(stream); //stearm == Stream[] images

            ////Console.WriteLine(text);

            //varTransformation.ConvertToPdf(varTranslation.TranslateText(varCipher.Decrypt(text)));


            //Test line
            //varTransformation.ConvertToPdf(varTranslation.TranslateText(varCipher.Decrypt(service.GetText(System.IO.File.OpenRead(@"C:\TempFolder\CipherText.png")))));
        }
        public ViewResult ScanPicture(IFormCollection form)
        {
            var service = new TesseractService(@"C:\Program Files\Tesseract-OCR", "eng", @"C:\Program Files\Tesseract-OCR\tessdata");
            var stream  = System.IO.File.OpenRead(form["_file"].ToString());

            scanned.ScannedText = service.GetText(stream);
            return(View(scanned));
        }
Example #3
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            TesseractService service = new TesseractService(@"C:\Program Files\Tesseract-OCR", "tha", @"C:\Program Files\Tesseract-OCR\tessdata");

            // var stream = File.OpenRead(string path);
            // var stream = WebRequest.Create(string url).GetResponse().GetResponseStream();
            // var stream = new MemoryStream(byte[] buffer);
            //var text = service.GetText(stream);

            lblResult.Text = service.GetText(fu.PostedFile.InputStream);
        }
 public TesseractController(TesseractService tesseractService)
 {
     this.tesseractService = tesseractService;
 }