mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2025-01-18 14:41:36 +08:00
allow multiple output in tesseract executable (https://groups.google.com/d/msg/tesseract-ocr/Z_WUKmJDVxc/1vc3W0xJZ2oJ)
This commit is contained in:
parent
d3448c37ab
commit
9e8629d9ef
@ -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;
|
||||||
|
@ -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,
|
||||||
|
@ -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:"
|
||||||
|
Loading…
Reference in New Issue
Block a user