Update README with comprehensive documentation and add MIT LICENSE
This commit is contained in:
1 parent
3706314c93
commit
5df055a4da
2 files changed
+99
-20
No files matched your search
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2025 Nate Emmert
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -1,34 +1,92 @@
|
||||
# PDF Rename Sort
|
||||
|
||||
A Python web app to rename PDF files based on form field data (last name and first name) using Flask.
|
||||
A Python web application built with Flask that automatically renames PDF files based on form field data extracted from within the PDFs. Designed for batch processing of fillable PDFs, extracting "Last Name" and "First Name" to create standardized filenames.
|
||||
|
||||
## Features
|
||||
|
||||
- Upload multiple PDF files or ZIP archives containing PDFs
|
||||
- Extracts "Last Name" and "First Name" from PDF form fields
|
||||
- Renames files to "LastName_FirstName.pdf" format
|
||||
- Handles duplicate names by appending a counter
|
||||
- Downloads renamed PDFs as a ZIP file
|
||||
- **Web-Based Interface**: Clean, responsive web UI for easy file uploads
|
||||
- **Batch Processing**: Handle multiple PDFs or ZIP archives containing PDFs
|
||||
- **Form Field Extraction**: Uses PyPDF2 to read PDF form fields
|
||||
- **Intelligent Renaming**: Renames files to "LastName_FirstName.pdf" format
|
||||
- **Duplicate Handling**: Automatically appends counters for duplicate names
|
||||
- **ZIP Support**: Upload ZIP files and download processed results as ZIP
|
||||
- **Error Handling**: Gracefully skips files that can't be processed
|
||||
|
||||
## Requirements
|
||||
## Prerequisites
|
||||
|
||||
- Python 3.6+
|
||||
- Flask
|
||||
- PyPDF2
|
||||
- Python 3.6 or higher
|
||||
- Virtual environment (recommended)
|
||||
|
||||
## Installation
|
||||
|
||||
1. Clone or download the repository
|
||||
2. Install dependencies: `pip install -r requirements.txt`
|
||||
3. Run the app: `python pdf_renamer.py` (ensure you're using the virtual environment Python)
|
||||
1. **Clone the repository**:
|
||||
```bash
|
||||
git clone https://gitlab.com/trbc-dev/pdf-rename-sort.git
|
||||
cd pdf-rename-sort
|
||||
```
|
||||
|
||||
2. **Create and activate virtual environment**:
|
||||
```bash
|
||||
python -m venv .venv
|
||||
# On Windows:
|
||||
& .venv/Scripts/Activate.ps1
|
||||
# On macOS/Linux:
|
||||
source .venv/bin/activate
|
||||
```
|
||||
|
||||
3. **Install dependencies**:
|
||||
```bash
|
||||
pip install -r requirements.txt
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
1. Activate the virtual environment: `& .venv/Scripts/Activate.ps1` (on Windows)
|
||||
2. Run: `python pdf_renamer.py`
|
||||
3. Open your browser to `http://127.0.0.1:3000/`
|
||||
4. Upload PDF files or ZIP archives
|
||||
5. Click "Process PDFs"
|
||||
6. Download the ZIP of renamed files from the results page
|
||||
1. **Run the application**:
|
||||
```bash
|
||||
python pdf_renamer.py
|
||||
```
|
||||
|
||||
Note: The PDFs must have form fields named "Last Name" and "First Name" for extraction to work.
|
||||
2. **Access the web interface**:
|
||||
Open your browser to `http://127.0.0.1:3000/`
|
||||
|
||||
3. **Upload files**:
|
||||
- Select individual PDF files or ZIP archives containing PDFs
|
||||
- Click "Process PDFs"
|
||||
|
||||
4. **Download results**:
|
||||
- Download the `renamed_files.zip` containing all processed PDFs
|
||||
- Review any skipped files listed on the results page
|
||||
|
||||
## How It Works
|
||||
|
||||
1. **File Upload**: Accepts PDFs or ZIPs via web form
|
||||
2. **Extraction**: If ZIP, extracts PDFs to temporary directory
|
||||
3. **Processing**: For each PDF, reads form fields using PyPDF2
|
||||
4. **Renaming**: Extracts "Last Name" and "First Name" values
|
||||
5. **Packaging**: Creates a ZIP archive of renamed PDFs
|
||||
6. **Download**: Provides secure download link for results
|
||||
|
||||
## Important Notes
|
||||
|
||||
- PDFs must contain fillable form fields named exactly "Last Name" and "First Name"
|
||||
- Files without these fields or with extraction errors will be skipped
|
||||
- All processing happens server-side with temporary file storage
|
||||
- Maximum upload size is limited to 100MB
|
||||
|
||||
## Development
|
||||
|
||||
To contribute or modify:
|
||||
|
||||
1. Fork the repository
|
||||
2. Create a feature branch
|
||||
3. Make your changes
|
||||
4. Test thoroughly
|
||||
5. Submit a pull request
|
||||
|
||||
## License
|
||||
|
||||
This project is licensed under the MIT License - see the LICENSE file for details.
|
||||
|
||||
## Support
|
||||
|
||||
For issues or questions, please open an issue on the GitLab repository.
|
||||
Reference in new issue
Block a user