July 21st, 2024

Remove PDF password protection using qpdf and AppleScript

The article explains how to remove PDF password protection on macOS using qpdf and AppleScript. It involves installing qpdf, creating a Quick Action in Automator, and running an AppleScript to decrypt PDFs. This method offers a lightweight solution for password removal.

Read original articleLink Icon
Remove PDF password protection using qpdf and AppleScript

The article discusses a method to remove password protection from PDF files using qpdf and AppleScript on macOS. It suggests installing qpdf via HomeBrew and utilizing macOS Automator to create a Quick Action named "Remove Password" that can be accessed by right-clicking a PDF file in Finder. The AppleScript code provided in the article prompts the user to enter the password for the PDF file and then decrypts the file, saving the decrypted version in the user's Downloads folder. This approach offers a lightweight alternative to bulky applications for removing PDF password protection, albeit requiring some Terminal commands. The integration of qpdf with Automator streamlines the process for users seeking a more convenient way to handle PDF password removal on macOS.

Link Icon 4 comments
By @dnh44 - 7 months
FYI this still requires that you know the password to unlock the PDF to begin with so it won't help open PDFs that you are locked out of. If you were already using print->save-as-pdf to remove passwords from pdfs then I don't think this will give you much more functionality.
By @ck45 - 7 months
I used to binary patch PDFKit to nop the password check (in PPC days). I wonder if that's still possible with code signatures.

Back then, there were also some other means, like writing your own InputManager to inject code, or F-Script Anywhere, which injected a F-Script interpreter into a process.

By @JohnKemeny - 7 months
Or just

pdftk input.pdf input_pw YOURPASSWORD output output.pdf