tesseract  5.0.0-alpha-619-ge9db
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
 
bool happy ()
 
int imagenum () const
 

Protected Member Functions

bool AddImageHandler (TessBaseAPI *api) override
 
- 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 157 of file renderer.h.

Constructor & Destructor Documentation

◆ TessTextRenderer()

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

Definition at line 121 of file renderer.cpp.

124  : TessResultRenderer(outputbase, "txt") {

Member Function Documentation

◆ AddImageHandler()

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

Implements tesseract::TessResultRenderer.

Definition at line 125 of file renderer.cpp.

127  {
128  const std::unique_ptr<const char[]> utf8(api->GetUTF8Text());
129  if (utf8 == nullptr) {
130  return false;
131  }
132 
133  AppendString(utf8.get());
134 
135  const char* pageSeparator = api->GetStringVariable("page_separator");
136  if (pageSeparator != nullptr && *pageSeparator != '\0') {
137  AppendString(pageSeparator);
138  }
139 

The documentation for this class was generated from the following files:
tesseract::TessResultRenderer::AppendString
void AppendString(const char *s)
Definition: renderer.cpp:101
tesseract::TessResultRenderer::TessResultRenderer
TessResultRenderer(const char *outputbase, const char *extension)
Definition: renderer.cpp:32