https://github.com/amit9838/invoice_generator
Generate Invoice using python.
https://github.com/amit9838/invoice_generator
automatic bills business customer invoice pdf python sales shops
Last synced: 6 months ago
JSON representation
Generate Invoice using python.
- Host: GitHub
- URL: https://github.com/amit9838/invoice_generator
- Owner: amit9838
- Created: 2023-01-27T04:27:29.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2023-01-29T03:51:50.000Z (over 2 years ago)
- Last Synced: 2025-04-23T03:08:07.639Z (6 months ago)
- Topics: automatic, bills, business, customer, invoice, pdf, python, sales, shops
- Language: Python
- Homepage:
- Size: 1.62 MB
- Stars: 5
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Automate your invoice with python
Automatically generate print friendly invoices/bills using python. [Sample pdf](https://github.com/amit9838/invoice_generator/blob/master/sample_invoice.pdf)
### Directions to use
Step 1 - Clone the repo or download the archive to you local system. Now head to "invoice_genarator" directory.
Step 2 - Install "reportlab" and "pillow" with following commands:
Run these commands in your terminal -
`pip install reportlab`
`pip install pillow`
or simply run
`pip install requirements.txt`
Step 3 - Now feed the data into the pdf.py file in array format.
That's it
### Working
Data is converted into objects for simplicity.
```python
# Sample Data
item = ['Dell Keboard Wireless', 'Samsung RAM 4GB','Samsung SSD 480GB']
warrenty=[12,24,36] # in months
unit_price = [700, 2400,4860]
qty = [1,2,1]
tax = [0,.18,.18]objects = []
class Product:
def __init__(self,item,warrenty,unit_price,tax,quantity):
self.item = item
self.unit_price = unit_price
self.warrenty = warrenty
self.tax = tax
self.quantity = quantity
self.t_price = unit_price*quantity
```Some useful offsets for repositioning of elements.
```python
# Y offsets - Global
y_offset = 0 # Header section (above Invoice,company)
cust_offset = 50 #Customer section
table_offset = 0 #Table section
sub_total_y_offset = -5 # Subtotal/total section offset# x-offsets in the table
unit_price_x_pos = 370 #Default 370
warrenty_x_pos = 280 #Default 280
qty_x_pos = 470 #Default 470
price_x_pos = 550 #Default 550# y-offset for new entries is dynamically calculated.
```### Reference
For in-depth usage visit [Documentation](https://docs.reportlab.com/reportlab/userguide/ch1_intro/) or for some extra recipies visit [More](https://www.reportlab.com/dev/docs/).