Begin adding new option to redo ocr

This commit is contained in:
James R. Barlow
2017-03-29 18:15:20 -07:00
parent 059f79242e
commit 8bc6019172
+9
View File
@@ -196,6 +196,11 @@ ocrsettings.add_argument(
help="skip OCR on any pages that already contain text, but include the "
"page in final output; useful for PDFs that contain a mix of "
"images, text pages, and/or previously OCRed pages")
ocrsettings.add_argument(
'--redo-ocr', action='store_true',
help="removing any existing OCR text, but otherwise preserve mixed PDF "
"pages")
ocrsettings.add_argument(
'--skip-big', type=float, metavar='MPixels',
help="skip OCR on pages larger than the specified amount of megapixels, "
@@ -322,6 +327,10 @@ def check_options_ocr_behavior(options, log):
raise argparse.ArgumentError(
"Error: --force-ocr and --skip-text are mutually incompatible.")
if options.redo_ocr and (options.skip_text or options.force_ocr):
raise argparse.ArgumentError(
"Error: --redo-ocr and other OCR options are incompatible.")
if set(options.language) & {'chi_sim', 'chi_tra'} and \
(options.pdf_renderer == 'hocr' or options.output_type == 'pdfa'):
log.warning(