An automated tool for filling PDF forms programmatically.
This Python-based tool automates the process of filling PDF forms, reducing manual data entry work and ensuring consistency in form processing.
.
├── src/
│ └── main.py # Main application code
├── tests/
│ └── test_form_filler.py # Test suite
├── inputs/
│ ├── OoPdfFormExample.pdf # Original PDF forms
│ └── filled/ # Directory for processed forms
└── .env.example # Environment variables template
- Automated PDF form filling using OpenAI gpt-4o-mini
- Smart field matching based on provided knowledge
- Logging system for tracking operations
- Automatic output directory management
- Error handling and validation
- Cannot fill in checkboxes
- Cannot fill in dropdown fields
- May generate haluncinated data for some fields
- Clone the repository
- Install required dependencies:
pip install PyPDF2 openai python-dotenv
- Configure environment variables:
- Copy
.env.example
to.env
- Add your OpenAI API key to
.env
:OPENAI_API_KEY=your_api_key_here
- Copy
- Place PDF forms in the
inputs/
directory - Create a
knowledge.txt
file with the information to fill in the forms
-
Prepare your knowledge base:
- Create a
knowledge.txt
file with information about the person - Use markdown headers to group information into context groups
- Create a
-
Run the application:
python src/main.py
The script will:
- Read the form fields from your PDF
- Use OpenAI's GPT-3.5 to match knowledge to form fields
- Generate a filled PDF in the
inputs/filled/
directory
Run tests using:
python -m pytest tests/
- Fork the repository
- Create your feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
This project is licensed under the terms to be determined.