tesseract  3.05.02
tesseract::TessTextRenderer Class Reference

#include <renderer.h>

Inheritance diagram for tesseract::TessTextRenderer:
tesseract::TessResultRenderer

Public Member Functions

 TessTextRenderer (const char *outputbase)
 
- Public Member Functions inherited from tesseract::TessResultRenderer
virtual ~TessResultRenderer ()
 
void insert (TessResultRenderer *next)
 
TessResultRenderernext ()
 
bool BeginDocument (const char *title)
 
bool AddImage (TessBaseAPI *api)
 
bool EndDocument ()
 
const char * file_extension () const
 
const char * title () const
 
int imagenum () const
 

Protected Member Functions

virtual bool AddImageHandler (TessBaseAPI *api)
 
- Protected Member Functions inherited from tesseract::TessResultRenderer
 TessResultRenderer (const char *outputbase, const char *extension)
 
virtual bool BeginDocumentHandler ()
 
virtual bool EndDocumentHandler ()
 
void AppendString (const char *s)
 
void AppendData (const char *s, int len)
 

Detailed Description

Renders tesseract output into a plain UTF-8 text string

Definition at line 141 of file renderer.h.

Constructor & Destructor Documentation

◆ TessTextRenderer()

tesseract::TessTextRenderer::TessTextRenderer ( const char *  outputbase)
explicit

Definition at line 122 of file renderer.cpp.

123  : TessResultRenderer(outputbase, "txt") {
124 }
TessResultRenderer(const char *outputbase, const char *extension)
Definition: renderer.cpp:32

Member Function Documentation

◆ AddImageHandler()

bool tesseract::TessTextRenderer::AddImageHandler ( TessBaseAPI api)
protectedvirtual

Implements tesseract::TessResultRenderer.

Definition at line 126 of file renderer.cpp.

126  {
127  char* utf8 = api->GetUTF8Text();
128  if (utf8 == NULL) {
129  return false;
130  }
131 
132  AppendString(utf8);
133  delete[] utf8;
134 
135  bool pageBreak = false;
136  api->GetBoolVariable("include_page_breaks", &pageBreak);
137  const char* pageSeparator = api->GetStringVariable("page_separator");
138  if (pageBreak) {
139  AppendString(pageSeparator);
140  }
141 
142  return true;
143 }
void AppendString(const char *s)
Definition: renderer.cpp:101

The documentation for this class was generated from the following files: