Command-line Decrypting of PDF, given a document open password

I've been given a PDF that is password-protected. I have the document-open password, which is enough to decrypt the contents and allow PDF readers to load the content correctly.

Is there a command-line tool that will perform this decryption process (based on the provided password) and write the decrypted PDF to a new file?

1

2 Answers

Yes. Qpdf should do what you want:

qpdf --password=thepassword --decrypt input.pdf output.pdf

You can find a download for Windows (assuming you have MinGW installed) if you go to Files->qpdf->latest version, then scroll down to find a description of the files (you can find a link to version 5.11, the most recent version as of 2014-3-28, here).

Choco users can install the package by issuing choco install qpdf (ref)

1

You can use pdftk's command-line version ("PDFtk Server"): (It is available for server platforms under a GPLv2 license)

pdftk "input filename.pdf" input_pw "password" output "output filename.pdf"

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like