Using PDFPassword
PDFPassword 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 PDFPassword:
NAME
pdfpassword -- PDF password protector and unprotector
SYNOPSIS
pdfpassword -e[ncrypt] <input_file> -p[assword] <password> -o[ut] <output_file> [-batch] [-v[erbosity] <level>]
pdfpassword -d[ecrypt] <input_file> -p[assword] <password> -o[ut] <output_file> [-batch] [-v[erbosity] <level>]
DESCRIPTION
This application encrypts and decrypts PDF documents with a password.
The options are as follows:
-e, -encrypt Encryption input - either a single file or a mask.
-d, -decrypt Decryption input.
-p, -password The password to use. This will be asked interactively if not provided in the command line (unless -batch is supplied).
-o, -out The name of the file to write the processing result to.
-b, -batch Avoid any interaction.
-v, -verbosity 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.
EXAMPLES
pdfpassword -e C:\helloworld.pdf -o C:\secretmessage.pdf -p p@ssw0rd
pdfpassword -encrypt C:\helloworld.pdf -out C:\secretmessage.pdf -password p@ssw0rd
pdfpassword -decrypt C:\secretmessage.pdf -out C:\nolongersecretmessage.pdf
pdfpassword -decrypt C:\secretmessage.pdf -out C:\nolongersecretmessage.pdf -password p@ssw0rd
pdfpassword -encrypt C:\*.pdf -batch
PDFPassword is available for Windows, Linux, and macOS.