2
0
mirror of https://github.com/koreader/koreader synced 2024-11-11 19:11:14 +00:00

add advanced option forced_ocr to force ocring text

This commit is contained in:
chrox 2014-07-17 22:32:20 +08:00
parent e91ddee836
commit 120f18737e
3 changed files with 10 additions and 1 deletions

View File

@ -402,7 +402,7 @@ returned boxes are in native page coordinates zoomed at 1.0
--]] --]]
function KoptInterface:getTextBoxes(doc, pageno) function KoptInterface:getTextBoxes(doc, pageno)
local text = doc:getPageTextBoxes(pageno) local text = doc:getPageTextBoxes(pageno)
if text and #text > 1 then if text and #text > 1 and doc.configurable.forced_ocr == 0 then
return text return text
-- if we have no text in original page then we will reuse native word boxes -- if we have no text in original page then we will reuse native word boxes
-- in reflow mode and find text boxes from scratch in non-reflow mode -- in reflow mode and find text boxes from scratch in non-reflow mode

View File

@ -201,6 +201,14 @@ local KoptOptions = {
values={0.5, 1.0, 1.5}, values={0.5, 1.0, 1.5},
default_value = DKOPTREADER_CONFIG_RENDER_QUALITY, default_value = DKOPTREADER_CONFIG_RENDER_QUALITY,
}, },
{
name = "forced_ocr",
name_text = S.FORCED_OCR,
toggle = {S.ON, S.OFF},
values = {1, 0},
default_value = 0,
advanced = true,
},
{ {
name = "defect_size", name = "defect_size",
name_text = S.DEFECT_SIZE, name_text = S.DEFECT_SIZE,

View File

@ -27,6 +27,7 @@ S.VIEW_MODE = _("View Mode")
S.EMBEDDED_STYLE = _("Embedded Style") S.EMBEDDED_STYLE = _("Embedded Style")
S.WRITING_DIR = _("Writing Direction") S.WRITING_DIR = _("Writing Direction")
S.PROGRESS_BAR = _("Progress Bar") S.PROGRESS_BAR = _("Progress Bar")
S.FORCED_OCR = _("Forced OCR")
S.ON = _("on") S.ON = _("on")
S.OFF = _("off") S.OFF = _("off")