A comprehensive solution for removing passwords from PDF files, including support for AES-256 encryption.
- Supports AES-256 encrypted PDFs
- Handles both user and owner passwords
- Follows PDF 2.0 specification for encryption
- Detailed error reporting
- Preserves PDF structure and content
- Python 3.x
- PyCryptodome (for AES encryption)
pip install -r requirements.txt
Remove a password from a PDF file:
python main.py <input_pdf> <password> <output_pdf>
Arguments:
<input_pdf>
: Path to the encrypted PDF file<password>
: The password for the PDF file<output_pdf>
: Path to save the decrypted PDF file
python main.py encrypted.pdf mypassword decrypted.pdf
This implementation:
- Supports PDF 2.0 encryption specification
- Implements AES-256 decryption
- Handles encryption dictionaries
- Preserves PDF object structure
- Properly manages stream decryption
- Only supports standard security handler
- Requires correct password for decryption
- May not support all PDF versions