from reportlab.lib.
pagesizes import A4
from reportlab.pdfgen import canvas
from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle
from reportlab.lib.styles import getSampleStyleSheet
from reportlab.lib import colors
import os
# File paths
file_paths = [
"/mnt/data/sample_business_report.pdf",
"/mnt/data/random_short_story.pdf",
"/mnt/data/invoice_template.pdf",
"/mnt/data/daily_task_checklist.pdf"
# 1. Business Report
doc = SimpleDocTemplate(file_paths[0], pagesize=A4)
styles = getSampleStyleSheet()
elements = []
elements.append(Paragraph("Sample Business Report", styles["Title"]))
elements.append(Spacer(1, 12))
elements.append(Paragraph("Executive Summary", styles["Heading2"]))
elements.append(Paragraph("This report outlines the quarterly performance of ABC Corp.
Revenue has increased by 15% compared to last quarter.", styles["Normal"]))
elements.append(Spacer(1, 12))
elements.append(Paragraph("Financial Overview", styles["Heading2"]))
data = [["Quarter", "Revenue", "Expenses", "Profit"],
["Q1", "$150,000", "$100,000", "$50,000"],
["Q2", "$180,000", "$110,000", "$70,000"]]
table = Table(data)
table.setStyle(TableStyle([("BACKGROUND", (0, 0), (-1, 0), colors.grey),
("TEXTCOLOR", (0, 0), (-1, 0), colors.whitesmoke),
("ALIGN", (0, 0), (-1, -1), "CENTER"),
("GRID", (0, 0), (-1, -1), 1, colors.black)]))
elements.append(table)
doc.build(elements)
# 2. Short Story
doc = SimpleDocTemplate(file_paths[1], pagesize=A4)
elements = []
elements.append(Paragraph("The Mysterious Door", styles["Title"]))
story_text = """On a quiet street, Ella discovered a small wooden door at the base of an old oak
tree.
It was no taller than her knees, yet it seemed to hum with hidden energy.
Curiosity won over fear, and she gently knocked. To her surprise, the door creaked open..."""
elements.append(Paragraph(story_text, styles["Normal"]))
doc.build(elements)
# 3. Invoice Template
doc = SimpleDocTemplate(file_paths[2], pagesize=A4)
elements = []
elements.append(Paragraph("Invoice", styles["Title"]))
elements.append(Spacer(1, 12))
invoice_data = [["Item", "Quantity", "Unit Price", "Total"],
["Laptop", "1", "$1,000", "$1,000"],
["Mouse", "2", "$25", "$50"],
["Keyboard", "1", "$75", "$75"],
["", "", "Grand Total", "$1,125"]]
invoice_table = Table(invoice_data)
invoice_table.setStyle(TableStyle([("BACKGROUND", (0, 0), (-1, 0), colors.grey),
("TEXTCOLOR", (0, 0), (-1, 0), colors.whitesmoke),
("ALIGN", (0, 0), (-1, -1), "CENTER"),
("GRID", (0, 0), (-1, -1), 1, colors.black)]))
elements.append(invoice_table)
doc.build(elements)
# 4. Daily Task Checklist
doc = SimpleDocTemplate(file_paths[3], pagesize=A4)
elements = []
elements.append(Paragraph("Daily Task Checklist", styles["Title"]))
tasks = ["Check emails", "Team meeting at 10 AM", "Work on project report", "Client call at 2
PM", "Submit daily summary"]
for t in tasks:
elements.append(Paragraph(f"[ ] {t}", styles["Normal"]))
elements.append(Spacer(1, 12))
doc.build(elements)
file_paths