Skip to content

Instantly share code, notes, and snippets.

@puhoy
Created March 5, 2021 15:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save puhoy/b25c17ea98fba9d5daf4ef4b74d88d6d to your computer and use it in GitHub Desktop.
Save puhoy/b25c17ea98fba9d5daf4ef4b74d88d6d to your computer and use it in GitHub Desktop.
#! /bin/bash
# needs qpdf and docker installed
set -x
decrypt_command="qpdf --replace-input --decrypt"
find . -name "*.pdf" -type f -exec echo DECRYPTING {} \; -exec $decrypt_command {} \;
ocr_command="docker run --rm --user $(id -u):$(id -g) --workdir /data -v $PWD:/data -i jbarlow83/ocrmypdf -l deu --rotate-pages --clean-final --jobs 4"
find . -name "*.pdf" -type f -exec echo PROCESSING {} \; -exec $ocr_command /data/{} /data/{} \;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment