Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

pdfEncrypt

A simple command-line tool to password-encrypt PDF files using Python.

Description

pdfEncrypt.py takes an existing PDF file and produces a new, password-protected copy of it. The original file is left untouched, and the encrypted version is saved alongside it with a _secured suffix (e.g., document_secured.pdf).

Requirements

Install the dependency with:

pip install PyPDF2

Usage

python pdfEncrypt.py -d <directory> -f <filename>

Arguments

Flag Long Form Description
-d --DIR Path to the directory containing the PDF file
-f --FILE Name of the PDF file to encrypt
-h --help Show help message

You will be prompted to enter a password securely after the arguments are validated.

Example

python pdfEncrypt.py -d "C:\Users\John\Documents" -f "report.pdf"

Output:

Enter a Password:
File was Encrypted.

This will create report_secured.pdf in the same directory as the original file.

Notes

  • The original PDF is not modified. A new file with the _secured suffix is created.
  • The password prompt uses getpass, so the password will not be visible as you type it.
  • The script currently uses Windows-style path separators (\). If running on macOS or Linux, update the path separator to /.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages