Add --tagged-pdf-mode option to control Tagged PDF handling
Allow users to bypass the TaggedPDFError when processing Tagged PDFs by setting --tagged-pdf-mode=ignore. This is useful when users know they want to OCR a Tagged PDF despite the warning. - 'default': Error if --mode is default, otherwise warn (current behavior) - 'ignore': Always warn but continue processing (never error)
This commit is contained in:
@@ -32,6 +32,7 @@ __ocrmypdf_arguments()
|
||||
--skip-text (skip OCR on any pages that already contain text)
|
||||
--redo-ocr (redo OCR on any pages that seem to have OCR already)
|
||||
--invalidate-digital-signatures (remove digital signatures from PDF)
|
||||
--tagged-pdf-mode (control behavior for Tagged PDFs)
|
||||
--skip-big (skip OCR on pages larger than this many MPixels)
|
||||
--optimize (select optimization level)
|
||||
--jpeg-quality (JPEG quality [0..100])
|
||||
@@ -232,6 +233,18 @@ redo (re-OCR pages, replacing old invisible text)"
|
||||
fi
|
||||
}
|
||||
|
||||
__ocrmypdf_tagged-pdf-mode()
|
||||
{
|
||||
local choices="default (error if --mode is default, otherwise warn)
|
||||
ignore (always warn but continue processing)"
|
||||
|
||||
COMPREPLY=( $( compgen -W "$choices" -- "$cur") )
|
||||
# Remove description if only one completion exists
|
||||
if [[ ${#COMPREPLY[*]} -eq 1 ]]; then
|
||||
COMPREPLY=( ${COMPREPLY[0]%% *} )
|
||||
fi
|
||||
}
|
||||
|
||||
__ocrmypdf_ocr-engine()
|
||||
{
|
||||
local choices="auto (select best available engine)
|
||||
@@ -293,6 +306,10 @@ __ocrmypdf_check_previous()
|
||||
__ocrmypdf_mode
|
||||
return 0
|
||||
;;
|
||||
--tagged-pdf-mode)
|
||||
__ocrmypdf_tagged-pdf-mode
|
||||
return 0
|
||||
;;
|
||||
--ocr-engine)
|
||||
__ocrmypdf_ocr-engine
|
||||
return 0
|
||||
|
||||
@@ -26,6 +26,12 @@ complete -c ocrmypdf -s s -l skip-text -d "skip OCR on any pages that already co
|
||||
complete -c ocrmypdf -l redo-ocr -d "redo OCR on any pages that seem to have OCR already"
|
||||
complete -c ocrmypdf -l invalidate-digital-signatures -d "invalidate digital signatures and allow OCR to proceed"
|
||||
|
||||
function __fish_ocrmypdf_tagged_pdf_mode
|
||||
echo -e "default\t"(_ "error if --mode is default, otherwise warn")
|
||||
echo -e "ignore\t"(_ "always warn but continue processing")
|
||||
end
|
||||
complete -c ocrmypdf -x -l tagged-pdf-mode -a '(__fish_ocrmypdf_tagged_pdf_mode)' -d "control behavior for Tagged PDFs"
|
||||
|
||||
complete -c ocrmypdf -s k -l keep-temporary-files -d "keep temporary files (debug)"
|
||||
|
||||
function __fish_ocrmypdf_languages
|
||||
|
||||
Reference in New Issue
Block a user