tesseract  3.03
tesseract::TessHOcrRenderer Class Reference

#include <renderer.h>

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

List of all members.

Public Member Functions

 TessHOcrRenderer ()

Protected Member Functions

virtual bool BeginDocumentHandler ()
virtual bool AddImageHandler (TessBaseAPI *api)
virtual bool EndDocumentHandler ()

Detailed Description

Renders tesseract output into an hocr text string

Definition at line 173 of file renderer.h.


Constructor & Destructor Documentation

Definition at line 161 of file renderer.cpp.

    : TessResultRenderer("HOcr", "hocr") {
}

Member Function Documentation

bool tesseract::TessHOcrRenderer::AddImageHandler ( TessBaseAPI api) [protected, virtual]

Implements tesseract::TessResultRenderer.

Definition at line 191 of file renderer.cpp.

                                                       {
  char* hocr = api->GetHOCRText(imagenum());
  if (hocr == NULL) return false;

  AppendString(hocr);
  delete[] hocr;

  return true;
}

Reimplemented from tesseract::TessResultRenderer.

Definition at line 165 of file renderer.cpp.

                                            {
  AppendString(
        "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
        "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n"
        "    \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n"
        "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" "
        "lang=\"en\">\n <head>\n  <title>\n");
  AppendString(title());
  AppendString(
      "</title>\n"
      "<meta http-equiv=\"Content-Type\" content=\"text/html;"
      "charset=utf-8\" />\n"
      "  <meta name='ocr-system' content='tesseract " VERSION "' />\n"
      "  <meta name='ocr-capabilities' content='ocr_page ocr_carea ocr_par"
      " ocr_line ocrx_word'/>\n"
      "</head>\n<body>\n");

  return true;
}
bool tesseract::TessHOcrRenderer::EndDocumentHandler ( ) [protected, virtual]

Reimplemented from tesseract::TessResultRenderer.

Definition at line 185 of file renderer.cpp.

                                          {
  AppendString(" </body>\n</html>\n");

  return true;
}

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines