I have some pdf files in a directory. Some of them are password protected, some of them are not. I know the passwords for each of the password protected files. How do I automate the process of removing passwords from each of the pdf files? I am thinking of something like:

Getting the password protected file.
Trying the given passwords from a wordlist I've made.
Printing out the password for the file.
Saving the file as 'Decrypted_filename.pdf'
I think you can solve your problem with pyPdf
How do I remove passwords of some of all the pdf files in a directory with python?