I get a few e-bills sent to me from my power provider and who knows why they password protect them, but looking for any workflows to remove the pw so hazel can do her thing. I know I can open it in preview and then just resave it without encryption but there must be a way to automate this. My other thought was since it’s the only pdf files I get that are protected to have hazel do it based on the fact that it is protected if that’s possible.
I think we could have an entire category on here just for paperless/pdf related talk.
My employer password protects payslips and for some reason also restricts us from printing them. I have found that this app works to strip the security.
on adding folder items to this_folder after receiving added_items
try
if (count of added_items) is greater than 0 then
tell application "PDF Expert" to launch
repeat with theItem in added_items
try
set thePath to theItem as text
if thePath does not end with ".download:" and thePath does not end with ".crdownload:" then
tell application "PDF Expert" to activate
tell application "PDF Expert"
open thePath
end tell
delay 0.5
tell application "System Events"
tell application process "PDF Expert"
keystroke "password"
key code 76
click menu item "Change Password..." of menu 1 of menu bar item "File" of menu bar 1
delay 1.0
key code 48
key code 48
key code 49
delay 0.5
tell application "PDF Expert" to close window 1 saving yes
end tell
end tell
end if
end try
end repeat
end if
end try
end adding folder items to
Does this mean that Readdle has added AppleScript support to PDF Expert? They didn’t seem terribly interested when I inquired early last year sometime.
Actually it looks like this is almost all UI scripting…
If you install QPDF (e.g. via homebrew), it has an option (--decrypt) that removes password protection. I use it on Windows at work so I can annotate documents properly and it is cross platform.
Then you just script it at the command line. It is free to use (Apache license), shouldn’t experience timing issues, etc. Just pop it into Hazel or a script and let it run.