addocr()
{
local input="$1"
+ local multi="$2"
local output="$input-out"
[ -n "$input" ] \
|| return $?
echo "ℹ️ INFO: adding ocr on file $input"
- ocrmypdf --quiet --jobs 1 --language deu $input $output \
- || errlog "could not add ocr on $input" \
- || return $?
+ if [ "$multi" == "true" ]; then
+ ocrmypdf --quiet --jobs 1 --language deu $input $output \
+ || errlog "could not add ocr on $input" \
+ || return $?
+ else
+ ocrmypdf --quiet --jobs $(nproc) --language deu $input $output \
+ || errlog "could not add ocr on $input" \
+ || return $?
+ fi
[ ! -f $output ] && return 0
detectsplit()
{
- local pdf=$1
+ local pdf="$1"
local trenn=
[ -n "$pdf" ] \
export -f optimize
find . -name "scanned-$$-*.pdf" \
| sort \
- | parallel --keep-order addocr {}
+ | parallel --keep-order addocr {} true
local startcount=1
local endcount=1