public override void ProcessFile(string filename) { List <IResultRenderer> resultRenderers = new List <IResultRenderer>(); switch (OutputFormat) { case "text": resultRenderers.Add(ResultRenderer.CreateTextRenderer(OutputFile)); break; case "hocr": resultRenderers.Add(ResultRenderer.CreateHOcrRenderer(OutputFile)); break; case "pdf": resultRenderers.Add(ResultRenderer.CreatePdfRenderer(OutputFile, Datapath + "\\tessdata")); break; } using (IResultRenderer renderer = new AggregateResultRenderer(resultRenderers)) { if (filename.EndsWith(".tif")) { ProcessTiffFile(renderer, filename); } else { ProcessFile(renderer, filename); } } }
public void CanRenderResultsIntoHOcrFile() { var resultPath = TestResultRunFile(@"ResultRenderers\HOCR\phototest"); using (var renderer = ResultRenderer.CreateHOcrRenderer(resultPath)) { var examplePixPath = TestFilePath("Ocr/phototest.tif"); ProcessFile(renderer, examplePixPath); } var expectedOutputFilename = Path.ChangeExtension(resultPath, "hocr"); Assert.That(File.Exists(expectedOutputFilename), $"Expected a HOCR file \"{expectedOutputFilename}\" to have been created; but none was found."); }
public override void ProcessFile(string filename) { List <IResultRenderer> resultRenderers = new List <IResultRenderer>(); switch (OutputFormat) { case "text": resultRenderers.Add(ResultRenderer.CreateTextRenderer(OutputFile)); break; case "hocr": resultRenderers.Add(ResultRenderer.CreateHOcrRenderer(OutputFile)); break; case "pdf": resultRenderers.Add(ResultRenderer.CreatePdfRenderer(OutputFile, Datapath, false)); break; } using (IResultRenderer renderer = new AggregateResultRenderer(resultRenderers)) { ProcessImageFile(renderer, filename); } }