Using PDF Password
PDF Password is a lightweight command-line tool that provides an easy way to work with password-encrypted PDF documents.
Use the following syntax to encrypt and decrypt documents using PDF Password:
NAME
pdfpassword -- PDF password protector and unprotector
USAGE
pdfpassword --encrypt <input_file> --password <password> --out <output_file> [--batch] [--verbosity <level>]
pdfpassword --decrypt <input_file> --password <password> --out <output_file> [--batch] [--verbosity <level>]
DESCRIPTION
This application encrypts and decrypts PDF documents with a password.
The options are as follows:
-e, --encrypt <path> Encryption input - either a single file or a mask.
-d, --decrypt <path> Decryption input.
-p, --password <password> The password to use. This will be asked interactively if not provided in
the command line (unless --batch or --passfile is supplied).
USE WITH EXTREME CARE - any password provided via the command line stays
in the clear in command history.
-f, --passfile <path> The file to read the password from (a safer alternative to --password).
-o, --out <path> The name of the file to write the processing result to.
-x, --extract <list> The subset of pages to encrypt or recover ('1,2,7-10,12').
-m, --merge Merge all input files together before encrypting or after decrypting.
-b, --batch Avoid any interaction.
-v, --verbosity <level> Verbosity detail level, from 0 (totally quiet) to 3 (verbose).
If --out parameter is omitted or in a multi-file (mask) mode, the output documents are saved
with <input_file>_ENCRYPTED.pdf and <input_file>_DECRYPTED.pdf names.
Encrypting in --batch mode with an omitted --password generates documents encrypted with an
empty password. Decrypting in --batch mode with an omitted or wrong password results in an error.
The --extract list specifies the pages of the merged document that should be kept in the output document.
EXAMPLES
Encrypt helloworld.pdf to secretmessage.pdf with a password provided in command line:
pdfpassword -e C:\helloworld.pdf -o C:\secretmessage.pdf -p p@ssw0rd
The same, but with the option names expanded:
pdfpassword --encrypt C:\helloworld.pdf --out C:\secretmessage.pdf --password p@ssw0rd
Encrypt helloworld.pdf to secretmessage.pdf with a password contained in password.txt:
pdfpassword --encrypt C:\helloworld.pdf --out C:\secretmessage.pdf --passfile C:\secrets\password.txt
Decrypt secretmessage.pdf to nolongersecretmessage.pdf. The password will be asked interactively:
pdfpassword --decrypt C:\secretmessage.pdf --out C:\nolongersecretmessage.pdf
Decrypt secretmessage.pdf to nolongersecretmessage.pdf using the provided password. The password will be asked again interactively if it doesn't match:
pdfpassword --decrypt C:\secretmessage.pdf --out C:\nolongersecretmessage.pdf --password p@ssw0rd
Encrypt all pdf files in C:\\ without any user interaction. The output files will be assigned with _ENCRYPTED postfix:
pdfpassword --encrypt C:\*.pdf --batch
Merge all pdf files in C:\\ and encrypt into one single file:
pdfpassword --encrypt C:\*.pdf --merge --batch
PDF Password is available for Windows, Linux, and macOS.