Compile business sales data into professional PDF grids and dispatch email attachments.
Tick off requirements as you build to track real-time completion.
Follow this chronological guide to build the project from scratch.
Build a PDF table layout mapping item details, prices, tax rate calculations, and aggregate total sums.
from reportlab.platypus import SimpleDocTemplate, Table, TableStyle, Paragraph, Spacer
from reportlab.lib.styles import getSampleStyleSheet
from reportlab.lib import colors
def create_invoice(filename, client_name, billing_items):
doc = SimpleDocTemplate(filename)
styles = getSampleStyleSheet()
story = [Paragraph(f"INVOICE FOR: {client_name}", styles['Title']), Spacer(1, 15)]
# Billing table header + rows
data = [["Item Description", "Qty", "Unit Price", "Total"]]
grand_total = 0
for item, qty, price in billing_items:
tot = qty * price
grand_total += tot
data.append([item, str(qty), f"\${price:.2f}", f"\${tot:.2f}"])
data.append(["", "", "Grand Total:", f"\${grand_total:.2f}"])
t = Table(data)
t.setStyle(TableStyle([
('BACKGROUND', (0,0), (-1,0), colors.grey),
('TEXTCOLOR', (0,0), (-1,0), colors.whitesmoke),
('ALIGN', (0,0), (-1,-1), 'CENTER'),
('BOTTOMPADDING', (0,0), (-1,0), 8),
('GRID', (0,0), (-1,-1), 1, colors.black),
]))
story.append(t)
doc.build(story)Real issues students hit during development and how to troubleshoot them fast.
Continue building your skills with similar projects.
Sleek weather dashboard using OpenWeather API with geolocation, 5-day forecast, and dynamic weather themes.
Personal budget tracker with transaction log, category breakdown, and Chart.js pie charts.
Movie discovery app with TMDB API, trending lists, search, and detail modals.