SmartInvoice Generator is a clean, professional Python tool that creates PDF invoices from CSV files.
It is designed as a real-world portfolio project:
- 🧩 Modular architecture
- 🧠 Clear separation of CLI, data logic, and PDF generation
- 🖨️ PDF creation using reportlab
- 📜 Logging system
- 🚀 Ready to extend with more metadata later
- 📥 Read invoice line items from a CSV file
- 🧮 Compute subtotal, tax, discount, and final total
- 📄 Generate a clean A4 PDF invoice containing:
- 🏷️ Header (project title, invoice number, date)
- 👤 Customer info
- 📋 Line items table
- ✅ Totals block
- 📝 Log each generated invoice to
logs/invoices.log - 🧰 Two execution modes:
python main.pypython -m smartinvoice.cli
smartinvoice_generator/
├── data/
│ └── sample_invoice.csv
├── logs/
│ └── .gitkeep
├── output/
├── smartinvoice/
│ ├── __init__.py
│ ├── invoice_data.py
│ ├── pdf_generator.py
│ ├── invoice_builder.py
│ └── cli.py
├── main.py
├── README.md
└── requirements.txt
Make sure you have Python 3.10+ installed.
Clone the repository:
git clone https://github.com/<your-username>/smartinvoice-generator.git
cd smartinvoice-generatorCreate and activate a virtual environment:
python3 -m venv .venv
source .venv/bin/activateInstall dependencies:
pip install -r requirements.txtpython main.py data/sample_invoice.csvpython -m smartinvoice.cli data/sample_invoice.csvBoth methods generate a PDF invoice in the output/ directory.
description,quantity,unit_price
Website design package,1,1500
Monthly hosting (12 months),12,25
Domain registration,1,15- 📁 Move invoice metadata (customer info, invoice number, etc.) into a config file
- 🖼️ Support embedding company logo
- 🧾 Add multiple invoice templates
- 💱 Add currency formatting options
- 📦 Package as a pip installable module
- 🌐 Add web UI (Flask or FastAPI)
MIT License — free to use, modify, and share.