This commit is contained in:
Zdenko Podobný 2014-09-19 23:33:47 +02:00
parent d3448c37ab
commit 9e8629d9ef
3 changed files with 29 additions and 8 deletions

View File

@ -297,19 +297,37 @@ int main(int argc, char **argv) {
} }
api.GetBoolVariable("tessedit_create_pdf", &b); api.GetBoolVariable("tessedit_create_pdf", &b);
if (b && renderer == NULL) if (b) {
renderer = new tesseract::TessPDFRenderer(outputbase, api.GetDatapath()); if (renderer == NULL)
renderer = new tesseract::TessPDFRenderer(outputbase, api.GetDatapath());
else
renderer->insert(new tesseract::TessPDFRenderer(outputbase,
api.GetDatapath()));
}
api.GetBoolVariable("tessedit_write_unlv", &b); api.GetBoolVariable("tessedit_write_unlv", &b);
if (b && renderer == NULL) if (b) {
renderer = new tesseract::TessUnlvRenderer(outputbase); if (renderer == NULL)
renderer = new tesseract::TessUnlvRenderer(outputbase);
else
renderer->insert(new tesseract::TessUnlvRenderer(outputbase));
}
api.GetBoolVariable("tessedit_create_boxfile", &b); api.GetBoolVariable("tessedit_create_boxfile", &b);
if (b && renderer == NULL) if (b) {
renderer = new tesseract::TessBoxTextRenderer(outputbase); if (renderer == NULL)
renderer = new tesseract::TessBoxTextRenderer(outputbase);
else
renderer->insert(new tesseract::TessBoxTextRenderer(outputbase));
}
if (renderer == NULL) api.GetBoolVariable("tessedit_create_txt", &b);
renderer = new tesseract::TessTextRenderer(outputbase); if (b) {
if (renderer == NULL)
renderer = new tesseract::TessTextRenderer(outputbase);
else
renderer->insert(new tesseract::TessTextRenderer(outputbase));
}
if (!api.ProcessPages(image, NULL, 0, renderer)) { if (!api.ProcessPages(image, NULL, 0, renderer)) {
delete renderer; delete renderer;

View File

@ -312,6 +312,8 @@ Tesseract::Tesseract()
"Write repetition char code", this->params()), "Write repetition char code", this->params()),
BOOL_MEMBER(tessedit_write_unlv, false, BOOL_MEMBER(tessedit_write_unlv, false,
"Write .unlv output file", this->params()), "Write .unlv output file", this->params()),
BOOL_MEMBER(tessedit_create_txt, true,
"Write .txt output file", this->params()),
BOOL_MEMBER(tessedit_create_hocr, false, BOOL_MEMBER(tessedit_create_hocr, false,
"Write .html hOCR output file", this->params()), "Write .html hOCR output file", this->params()),
BOOL_MEMBER(tessedit_create_pdf, false, BOOL_MEMBER(tessedit_create_pdf, false,

View File

@ -927,6 +927,7 @@ class Tesseract : public Wordrec {
BOOL_VAR_H(tessedit_write_rep_codes, false, BOOL_VAR_H(tessedit_write_rep_codes, false,
"Write repetition char code"); "Write repetition char code");
BOOL_VAR_H(tessedit_write_unlv, false, "Write .unlv output file"); BOOL_VAR_H(tessedit_write_unlv, false, "Write .unlv output file");
BOOL_VAR_H(tessedit_create_txt, true, "Write .txt output file");
BOOL_VAR_H(tessedit_create_hocr, false, "Write .html hOCR output file"); BOOL_VAR_H(tessedit_create_hocr, false, "Write .html hOCR output file");
BOOL_VAR_H(tessedit_create_pdf, false, "Write .pdf output file"); BOOL_VAR_H(tessedit_create_pdf, false, "Write .pdf output file");
INT_VAR_H(tessedit_pdf_compression, 0, "Type of image encoding in pdf output:" INT_VAR_H(tessedit_pdf_compression, 0, "Type of image encoding in pdf output:"