Skip to content

Instantly share code, notes, and snippets.

@Senya247
Created June 23, 2023 17:14
Show Gist options
  • Save Senya247/82aab66950f817bc8bc3e096f58b7445 to your computer and use it in GitHub Desktop.
Save Senya247/82aab66950f817bc8bc3e096f58b7445 to your computer and use it in GitHub Desktop.
#!/bin/bash
if ! command -v ocrmypdf &>/dev/null; then
echo "Can't find ocrmypdf"
exit 1
fi
if [[ $# -ne 1 ]]; then
echo "Usage: $0 <filename.pdf>"
exit 1
fi
filename="$1"
if [[ ! -f "$filename" ]]; then
echo "File not found."
exit 1
fi
new_filename="${filename%.*}_t.pdf"
ocrmypdf "$filename" "$new_filename"
echo "OCR completed"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment