Created
June 27, 2020 14:24
-
-
Save BaksiLi/25b117c61963896f6c47c20704153fff to your computer and use it in GitHub Desktop.
Decrypt PDF by password stored in the Spotlight comment
This file contains hidden or 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/bash | |
# Decrypt PDF by password stored in the Spotlight comment. | |
read -d '' Script << EOF | |
tell application "Finder" | |
set Comm to comment of (POSIX file "$1" as alias) | |
end tell | |
return Comm | |
EOF | |
COMMENT=$(osascript -e "$Script") | |
echo $COMMENT | |
qpdf --password="$COMMENT" --decrypt "$1" "${1/.pdf/.decrypt.pdf}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment