That given, you can use: qpdf -decrypt protected.pdf out. If you have an older version of qpdf (prior to v10.2.0), -password-file= didn't work this way, but one could still read a whole argument from stdin with the option. In Windows, I think it would be Ctrl+ z, but I'm not sure). You can then type, RET and Ctrl+ d ( Ctrl+ d sends EOF in Linux. Once you enter that, qpdf will be waiting for input from stdin.
Open the 'Unlock' tool, then choose 'Tools,' 'Protect,' 'Encrypt' and then 'Remove Security' as each becomes available from 'Tools. qpdf can read a password from stdin passing - to the -password-file= option: qpdf -password-file=-decrypt protected.pdf out.pdf Here are the steps to remove a PDF password on Acrobat Reader: Open the PDF file in Acrobat Reader. The password is then queried in the terminal and you can type it. With pdftk we can use: pdftk protected.pdf input_pw output out.pdf do_ask
But maybe you received a pdf from a company which used some data of yours to encrypt the file, and you'd like to avoid leaking it. Of course, since this is about removing the password protection from the file, maybe you don't care. This is an old question, but seems to be a reference on the matter and, surprisingly, none of the answers tells us how to avoid passing the password on the command line (which may be a source of leakage).