19 #include "config_auto.h" 34 const char* extension)
35 : file_extension_(extension),
36 title_(
""), imagenum_(-1),
40 if (strcmp(outputbase,
"-") && strcmp(outputbase,
"stdout")) {
42 fout_ = fopen(outfile.
string(),
"wb");
43 if (fout_ ==
nullptr) {
50 if (fout_ !=
nullptr) {
60 if (
next ==
nullptr)
return;
65 while (
next->next_ !=
nullptr) {
68 next->next_ = remainder;
73 if (!happy_)
return false;
84 if (!happy_)
return false;
94 if (!happy_)
return false;
127 const std::unique_ptr<const char[]> utf8(api->
GetUTF8Text());
128 if (utf8 ==
nullptr) {
135 if (pageSeparator !=
nullptr && *pageSeparator !=
'\0') {
152 font_info_ = font_info;
157 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" 158 "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n" 159 " \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n" 160 "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" " 161 "lang=\"en\">\n <head>\n <title>");
165 "<meta http-equiv=\"Content-Type\" content=\"text/html;" 166 "charset=utf-8\" />\n" 167 " <meta name='ocr-system' content='tesseract " PACKAGE_VERSION
169 " <meta name='ocr-capabilities' content='ocr_page ocr_carea ocr_par" 170 " ocr_line ocrx_word ocrp_wconf");
173 " ocrp_lang ocrp_dir ocrp_font ocrp_fsize");
176 "</head>\n<body>\n");
189 if (hocr ==
nullptr)
return false;
206 font_info_ = font_info;
212 "level\tpage_num\tblock_num\tpar_num\tline_num\tword_" 213 "num\tleft\ttop\twidth\theight\tconf\ttext\n");
221 if (tsv ==
nullptr)
return false;
236 const std::unique_ptr<const char[]> unlv(api->
GetUNLVText());
237 if (unlv ==
nullptr)
return false;
253 if (text ==
nullptr)
return false;
260 #ifndef DISABLED_LEGACY_ENGINE 270 if (osd ==
nullptr)
return false;
278 #endif // ndef DISABLED_LEGACY_ENGINE virtual ~TessResultRenderer()
TessResultRenderer * next()
char * GetHOCRText(ETEXT_DESC *monitor, int page_number)
virtual bool AddImageHandler(TessBaseAPI *api)
char * GetTSVText(int page_number)
const char * string() const
virtual bool BeginDocumentHandler()
TessBoxTextRenderer(const char *outputbase)
bool Serialize(FILE *fp, const char *data, size_t n)
const char * GetStringVariable(const char *name) const
char * GetBoxText(int page_number)
virtual bool AddImageHandler(TessBaseAPI *api)=0
bool BeginDocument(const char *title)
TessTextRenderer(const char *outputbase)
virtual bool AddImageHandler(TessBaseAPI *api)
virtual bool EndDocumentHandler()
TessUnlvRenderer(const char *outputbase)
virtual bool AddImageHandler(TessBaseAPI *api)
virtual bool BeginDocumentHandler()
void AppendData(const char *s, int len)
bool AddImage(TessBaseAPI *api)
virtual bool AddImageHandler(TessBaseAPI *api)
virtual bool AddImageHandler(TessBaseAPI *api)
const char * title() const
TessResultRenderer(const char *outputbase, const char *extension)
TessOsdRenderer(const char *outputbase)
void insert(TessResultRenderer *next)
void AppendString(const char *s)
virtual bool AddImageHandler(TessBaseAPI *api)
virtual bool EndDocumentHandler()
virtual bool EndDocumentHandler()
TessHOcrRenderer(const char *outputbase, bool font_info)
char * GetOsdText(int page_number)
virtual bool BeginDocumentHandler()
TessTsvRenderer(const char *outputbase, bool font_info)