from [Link].
pagesizes import letter
from [Link] import getSampleStyleSheet, ParagraphStyle
from [Link] import SimpleDocTemplate, Paragraph, Spacer
from [Link] import inch
from [Link] import colors
doc = SimpleDocTemplate("[Link]", pagesize=letter, rightMargin=72,
leftMargin=72, topMargin=72, bottomMargin=72)
styles = getSampleStyleSheet()
# Custom styles for better readability
title_style = ParagraphStyle('Title', parent=styles['Title'], fontSize=16,
spaceAfter=30, textColor=[Link])
heading1_style = ParagraphStyle('Heading1', parent=styles['Heading1'], fontSize=14,
spaceAfter=12, textColor=[Link])
heading2_style = ParagraphStyle('Heading2', parent=styles['Heading2'], fontSize=12,
spaceAfter=10, textColor=[Link])
normal_style = ParagraphStyle('Normal', parent=styles['Normal'], fontSize=11,
spaceAfter=8, leading=14)
story = []
# Read the text content
with open('/home/workdir/attachments/Pasted Text-aab38004-a8e5-4b76-bb6b-
[Link]', 'r', encoding='utf-8') as f:
text = [Link]()
# Split into sections and add formatted paragraphs
lines = [Link]('\n')
i = 0
while i < len(lines):
line = lines[i].strip()
if [Link]('---'):
i += 1
continue
if [Link]('1.') or [Link]('2.') or [Link]('3.') or
[Link]('4.') or [Link]('5.') or 'Exam Writing Tip' in line:
[Link](Paragraph(line, title_style))
[Link](Spacer(1, 12))
elif [Link](':') and len(line) > 5 and not line[0].isdigit():
[Link](Paragraph(line, heading1_style))
[Link](Spacer(1, 6))
elif line and line[0].isdigit() and line[1] == '.':
[Link](Paragraph(line, heading2_style))
elif line:
[Link](Paragraph(line, normal_style))
else:
[Link](Spacer(1, 6))
i += 1
[Link](story)
print("PDF created successfully as [Link]")