A simple command-line tool to generate professional HTML invoices that can be easily converted to PDF.
- Interactive CLI interface for entering invoice details
- Support for multiple tasks per invoice
- Configurable company details and branding
- Custom hourly rates (fixed or variable per task)
- Professional HTML output with print-optimized styling
- Easy conversion to PDF using browser print function
- Ensure you have Python installed on your system
- Clone this repository
- Install dependencies:
pip install -r requirements.txt
- Create necessary directories (will be created automatically on first run):
assets/
- for storing logo filesinvoices/
- for generated invoice files
The tool uses a config.json
file for basic settings. You can create or modify it with the following structure:
{
"company": {
"name": "Your Company Name",
"address": "123 Main St, City, State, ZIP",
"phone": "555-1234",
"email": "[email protected]"
},
"tasks": [
{
"name": "Task 1",
"rate": 50
},
{
"name": "Task 2",
"rate": 60
}
]
}
company
: Your business detailsname
: Company name that appears on invoicesaddress
: Full company addressphone
: Contact phone numberemail
: Contact email address
tasks
: Predefined list of tasks with default ratesname
: Task name/descriptionrate
: Default hourly rate for this task type
If no config file exists, the tool will create one with default values.
python cli.py
-
Client Information
Enter client/organization name: [Client Name]
-
Task Selection
Select task type or enter custom task: 1. Task 1 ($50/hr) 2. Task 2 ($60/hr) 3. Custom task
-
Task Details
Enter task date (YYYY-MM-DD): [Date] Enter hours spent: [Hours]
-
Adding More Tasks
Add another task? (y/n): [y/n]
$ python cli.py
Enter client/organization name: Acme Corp
Select task type:
1. Task 1 ($50/hr)
2. Task 2 ($60/hr)
3. Custom task
Choice: 1
Enter task date (YYYY-MM-DD): 2024-03-15
Enter hours spent: 8
Add another task? (y/n): n
The tool will generate an HTML invoice in the generated-invoices
directory. The filename will include the client name and date.
- Open the generated HTML file in your browser
- Press
Ctrl+P
(orCmd+P
on Mac) - Select "Save as PDF" in the print dialog
- Click "Save"
- Dates must be in YYYY-MM-DD format
- You can press Ctrl+C at any time to cancel invoice generation
- The generated HTML is optimized for A4 paper size
- All monetary values are in USD