Hazel: How do you deal with PDF files that have copy protection?

Hello Automators!

I’m trying to setup some Hazel rules organized the several PDFs that I have. Plenty for these are bank statements, which isn’t an issue except for a particular bank that encrypts the PDF such that you can’t read/copy it’s contents. You can definitely view the contents but I can’t find a way to “read” the text software wise. Password is set by the bank and not shared.

Any tips on how to deal with these?

This is what Preview.app says about the encryption.

CleanShot 2021-08-23 at 10.59.49@2x

I use QPDF to remove those sorts of options from software manuals so I can add my own annotations and copy content from them.

Thank you! It worked great!

Similar problem with AmEx statements. I like to delete the extraneous pages from the PDF, the “backsides” of two-sided paper copies. But system will not let me delete pages from the document.
Error message: Document permissions do not allow this action. Enter the document owner password to permit it. Password ____

I found that if I generate a PDF from that file then it allows me to do it – making a copy, or “Duplicate” in the Finder, does not work. Only Print > “Save As” another PDF.

So the workflow is
-Download statement.pdf from AmEx.com … (Hazel moves to proper directory)
-Open statement (with PDFPen Pro; Preview also works)
-Print > PDF > Save as PDF statement_copy.pdf
-Close statement.pdf
-Open statement_copy.pdf
-Delete extraneous pages
-Delete original statement.pdf
-Rename statement_copy.pdf to statement.pdf

One of the great high points of my life would be to automate or improve this tedious process, and I assume it would be doable with Keyboard Maestro or Automator or whatnot (that reminds me of Lydia’s quote from Better Call Saul!). The times I have started to try it though, I got distracted with life or with something else.

The exact same QPDF tool for removing the protection can do those other things too, as well as much more. It is like a Swiss Army knife for PDF files.