Remove password from a lot of pdfs

Hello I have a problem with the removal of the passwords from pdfs.

My system is Mac high Sierra and also using Hazel.

My banks sends my around 30 PDF (from stock Saving plan) via Mail every month.

I open every of it and put via km the password in save it with the same name, replace the old file - close and go to the next file.

So it okay but several times it doesn't work and I think it should be easier with a script which do this in the backround without open it in preview.

I found some scripts but they are often the decrypt the files without knowing the password.

Is there a easy go through via a script/automator/Hazel or km?

Thanks alot

Here are a few threads that might steer you in the right direction:

I use qpdf ( with hazel to accomplish that but you have to add the password through command line. You can install it with brew

qpdf --decrypt --password=blablabla "$1" "/new/path/pdf"

then I have my pdfs in a separate folder without a pw


Thank you. I think I installed it correctly and replaced bla bla with my password and put the code in hazel as"run apple script"?

Nothing happened. No errors or something.

I just want to replace the files with the decrypted ones. is there I error?