33 const char* extension)
34 : file_extension_(extension),
35 title_(
""), imagenum_(-1),
39 if (strcmp(outputbase,
"-") && strcmp(outputbase,
"stdout")) {
41 fout_ = fopen(outfile.
string(),
"wb");
59 if (
next == NULL)
return;
64 while (
next->next_ != NULL) {
67 next->next_ = remainder;
72 if (!happy_)
return false;
83 if (!happy_)
return false;
93 if (!happy_)
return false;
106 int n = fwrite(s, 1, len, fout_);
107 if (n != len) happy_ =
false;
127 char* utf8 =
api->GetUTF8Text();
135 bool pageBreak =
false;
136 api->GetBoolVariable(
"include_page_breaks", &pageBreak);
137 const char* pageSeparator =
api->GetStringVariable(
"page_separator");
155 font_info_ = font_info;
160 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" 161 "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n" 162 " \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n" 163 "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" " 164 "lang=\"en\">\n <head>\n <title>");
168 "<meta http-equiv=\"Content-Type\" content=\"text/html;" 169 "charset=utf-8\" />\n" 172 " <meta name='ocr-capabilities' content='ocr_page ocr_carea ocr_par" 173 " ocr_line ocrx_word");
176 " ocrp_lang ocrp_dir ocrp_font ocrp_fsize ocrp_wconf");
179 "</head>\n<body>\n");
192 if (hocr == NULL)
return false;
210 font_info_ = font_info;
216 "level\tpage_num\tblock_num\tpar_num\tline_num\tword_" 217 "num\tleft\ttop\twidth\theight\tconf\ttext\n");
225 if (tsv == NULL)
return false;
241 char* unlv =
api->GetUNLVText();
242 if (unlv == NULL)
return false;
259 if (text == NULL)
return false;
275 if (osd == NULL)
return false;
virtual bool AddImageHandler(TessBaseAPI *api)
virtual bool EndDocumentHandler()
void insert(TessResultRenderer *next)
virtual bool EndDocumentHandler()
bool AddImage(TessBaseAPI *api)
virtual bool AddImageHandler(TessBaseAPI *api)
virtual bool AddImageHandler(TessBaseAPI *api)
bool BeginDocument(const char *title)
virtual bool AddImageHandler(TessBaseAPI *api)=0
virtual bool AddImageHandler(TessBaseAPI *api)
virtual bool BeginDocumentHandler()
TessTsvRenderer(const char *outputbase, bool font_info)
TessResultRenderer * next()
TessBoxTextRenderer(const char *outputbase)
virtual bool AddImageHandler(TessBaseAPI *api)
const char * string() const
TessOsdRenderer(const char *outputbase)
virtual bool BeginDocumentHandler()
TessUnlvRenderer(const char *outputbase)
const char * title() const
virtual ~TessResultRenderer()
virtual bool EndDocumentHandler()
virtual bool AddImageHandler(TessBaseAPI *api)
void AppendString(const char *s)
virtual bool BeginDocumentHandler()
void AppendData(const char *s, int len)
TessHOcrRenderer(const char *outputbase, bool font_info)
#define TESSERACT_VERSION_STR
TessResultRenderer(const char *outputbase, const char *extension)
TessTextRenderer(const char *outputbase)