Introduction
The qpdf is an open-source command-line tool and C++ library for working with PDF files. It offers a wide range of functionalities for manipulating, inspecting, and transforming PDFs, making it a valuable tool for developers, system administrators, and advanced users.
Removing the password
To remove the password from a PDF file in the Linux terminal, use the command:
$ bash
qpdf --decrypt --password=YOUR_PASSWORD protected_file.pdf unprotected_file.pdf
Replace YOUR_PASSWORD with the PDF's password, protected_file.pdf with the name of the protected PDF file, and unprotected_file.pdf with the name you want for the password-free file.
Replacing the original file
To overwrite the original PDF file with the decrypted version, use the following command in the terminal:
$ bash
qpdf --replace-input --decrypt --password=YOUR_PASSWORD filename.pdf
Replace YOUR_PASSWORD with the actual file password and filename.pdf with the correct name of your PDF document.
After running this command, the original file will be replaced with the password-free version. The qpdf command also automatically creates a backup of the original file, with the same name plus the .~qpdf-orig extension.