Removing PW from protected PDF

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.

Here is what I’ve done time ago to resolve a similar problem. It’s an automatic translation via Google Translator.

This is the original post in italian .

I hope it’s what you are searching.

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.

I have not automated it yet, as I only have to deal with one PDF every month.

1 Like

I’ve previously used PDFPasswordRemover from, but it doesn’t seem to be available any more. Perhaps it landed somewhere else.

1 Like

I know the password so that’s not the issue, Don’t know why they feel it necessary to PW protect in first place.

– PDF Security - Remove PWD “password”
– Created by Vikram Muthukrishnan on Mon Jul 16 2018
– Copyright © 2018-2020. All rights reserved.
– Extensively borrowed outline from DevonThink (Thanks Guys)
– About the script
– Replace the word “password” with your password
– Set this up as a folder action script
– You’ll need PDF Expert
– You can tweak this to improve the script further… :slight_smile:

			on adding folder items to this_folder after receiving added_items
					if (count of added_items) is greater than 0 then
						tell application "PDF Expert" to launch
						repeat with theItem in added_items
								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…

you are right, 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.

1 Like