new: add ocr.bash scriptto streamline ocr file creation.

This commit is contained in:
Jan Jambor 2025-03-12 16:21:43 +01:00
parent eafea7ff54
commit dcc5768868

24
resources/scripts/ocr.bash Executable file
View 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