tesseract  5.0.0-alpha-619-ge9db
tesseract::TessHOcrRenderer Class Reference

#include <renderer.h>

Inheritance diagram for tesseract::TessHOcrRenderer:
tesseract::TessResultRenderer

Public Member Functions

 TessHOcrRenderer (const char *outputbase, bool font_info)
 
 TessHOcrRenderer (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 BeginDocumentHandler () override
 
bool AddImageHandler (TessBaseAPI *api) override
 
bool EndDocumentHandler () override
 
- Protected Member Functions inherited from tesseract::TessResultRenderer
 TessResultRenderer (const char *outputbase, const char *extension)
 
void AppendString (const char *s)
 
void AppendData (const char *s, int len)
 

Detailed Description

Renders tesseract output into an hocr text string

Definition at line 168 of file renderer.h.

Constructor & Destructor Documentation

◆ TessHOcrRenderer() [1/2]

tesseract::TessHOcrRenderer::TessHOcrRenderer ( const char *  outputbase,
bool  font_info 
)
explicit

Definition at line 460 of file hocrrenderer.cpp.

◆ TessHOcrRenderer() [2/2]

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

Definition at line 455 of file hocrrenderer.cpp.

455  ://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n"
456  "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" "
457  "lang=\"en\">\n <head>\n <title>");
458  AppendString(title());

Member Function Documentation

◆ AddImageHandler()

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

Implements tesseract::TessResultRenderer.

Definition at line 496 of file hocrrenderer.cpp.

◆ BeginDocumentHandler()

bool tesseract::TessHOcrRenderer::BeginDocumentHandler ( )
overrideprotectedvirtual

Reimplemented from tesseract::TessResultRenderer.

Definition at line 465 of file hocrrenderer.cpp.

476  {
477  AppendString(" </body>\n</html>\n");
478 
479  return true;
480 }
481 
483  const std::unique_ptr<const char[]> hocr(api->GetHOCRText(imagenum()));
484  if (hocr == nullptr) return false;
485 
486  AppendString(hocr.get());
487 
488  return true;

◆ EndDocumentHandler()

bool tesseract::TessHOcrRenderer::EndDocumentHandler ( )
overrideprotectedvirtual

Reimplemented from tesseract::TessResultRenderer.

Definition at line 490 of file hocrrenderer.cpp.


The documentation for this class was generated from the following files:
tesseract::TessResultRenderer::AppendString
void AppendString(const char *s)
Definition: renderer.cpp:101
tesseract::TessHOcrRenderer::AddImageHandler
bool AddImageHandler(TessBaseAPI *api) override
Definition: hocrrenderer.cpp:496
tesseract::TessResultRenderer::title
const char * title() const
Definition: renderer.h:89
tesseract::TessResultRenderer::imagenum
int imagenum() const
Definition: renderer.h:107
TessBaseAPI
struct TessBaseAPI TessBaseAPI
Definition: capi.h:72