new: add ocr.bash scriptto streamline ocr file creation.
This commit is contained in:
parent
eafea7ff54
commit
dcc5768868
1 changed files with 24 additions and 0 deletions
24
resources/scripts/ocr.bash
Executable file
24
resources/scripts/ocr.bash
Executable file
|
|
@ -0,0 +1,24 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Simple script to OCR multiple PDFs using ocrmypdf.
|
||||||
|
# Usage: ocrpdf.sh input.pdf
|
||||||
|
|
||||||
|
if [ $# -eq 0 ]; then
|
||||||
|
echo "Usage: $(basename "$0") input.pdf"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
for f in "$@"; do
|
||||||
|
# Make sure it's a PDF
|
||||||
|
if [[ "$f" == *.pdf ]]; then
|
||||||
|
dir=$(dirname "$f")
|
||||||
|
base=$(basename "$f" .pdf)
|
||||||
|
out="${dir}/${base}-ocr.pdf"
|
||||||
|
|
||||||
|
echo "Processing $f -> $out"
|
||||||
|
ocrmypdf --redo-ocr "$f" "$out"
|
||||||
|
echo "Created: $out"
|
||||||
|
else
|
||||||
|
echo "Skipping non-PDF file: $f"
|
||||||
|
fi
|
||||||
|
done
|
||||||
Loading…
Add table
Add a link
Reference in a new issue