return $lastexit
}
+check_commands()
+{
+ command -v scanimage > /dev/null \
+ || errlog "command scanimage not found" \
+ || return $?
+ command -v qpdf > /dev/null \
+ || errlog "command qpdf not found" \
+ || return $?
+ command -v ocrmypdf > /dev/null \
+ || errlog "command ocrmypdf not found" \
+ || return $?
+ command -v tiff2pdf > /dev/null \
+ || errlog "command tiff2pdf not found" \
+ || return $?
+ command -v pdftk > /dev/null \
+ || errlog "command pdftk not found" \
+ || return $?
+ command -v zbarimg > /dev/null \
+ || errlog "command zbarimg not found" \
+ || return $?
+ command -v tiff2pdf > /dev/null \
+ || errlog "command tiff2pdf not found" \
+ || return $?
+}
+
optimize()
{
local input="$1"
local output="$input-out"
- command -v qpdf > /dev/null \
- || errlog "command qpdf not found" \
- || return $?
[ -n "$input" ] \
|| errlog "missing input" \
|| return $?
+
qpdf --linearize $input $output \
|| errlog "could not linearize $input" \
|| return $?
local input="$1"
local output="$input-out"
- command -v ocrmypdf > /dev/null \
- || errlog "command ocrmypdf not found" \
- || return $?
[ -n "$input" ] \
|| errlog "missing input" \
|| return $?
{
local output=$1
- command -v tiff2pdf > /dev/null \
- || errlog "command tiff2pdf not found" \
- || return $?
- command -v pdftk > /dev/null \
- || errlog "command pdftk not found" \
- || return $?
[ -n "$output" ] \
|| errlog "missing output" \
|| return $?
local pdfs=()
basename=${basename:="out"}
- command -v pdftk > /dev/null \
- || errlog "command pdftk not found" \
- || return $?
[ -n "$start" ] \
|| errlog "missing start" \
|| return $?
local pdf=$1
local trenn=
- command -v zbarimg > /dev/null \
- || errlog "command zbarimg not found" \
- || return $?
[ -n "$pdf" ] \
|| errlog "missing pdf" \
|| return $?
local startcount=1
local endcount=1
- command -v tiff2pdf > /dev/null \
- || errlog "command tiff2pdf not found" \
- || return $?
[ -n "$basename" ] \
|| errlog "missing basename" \
|| return $?
local pagecount="$2"
local output="$3"
- command -v scanimage > /dev/null \
- || errlog "command scanimage not found" \
+ check_commands \
|| return $?
[ -n "$mode" ] \
|| errlog "missing mode" \