Created
July 4, 2020 20:36
-
-
Save willangley/d69337a09089765ef7d0dba6a8603dee to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/zsh | |
# Copyright 2020 Google LLC. | |
# SPDX-License-Identifier: Apache-2.0 | |
# For use as a step in an Automator action. | |
# Expects input to be passed as arguments. | |
export PATH=/usr/local/bin:$PATH | |
for pdf in "$@"; do | |
out_pdf="$(mktemp ocrmypdf.XXXXXX)" | |
ocrmypdf --rotate-pages --deskew "$pdf" "$out_pdf" | |
osascript -e "tell application \"Finder\" to delete POSIX file \"${pdf}\"" | |
mv "$out_pdf" "$pdf" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment