from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer from reportlab.lib.styles import getSampleStyleSheet import io from datetime import datetime def build_litigation_appendix(records): buffer = io.BytesIO() doc = SimpleDocTemplate(buffer) styles = getSampleStyleSheet() story = [] story.append(Paragraph("Litigation Appendix", styles["Title"])) story.append(Spacer(1, 12)) story.append(Paragraph( f"Generated: {datetime.utcnow().strftime('%B %d, %Y UTC')}", styles["Normal"] )) story.append(Spacer(1, 12)) exhibit_num = 1 for r in records: exhibit = f"Exhibit A-{exhibit_num}" story.append(Paragraph(f"{exhibit}", styles["Heading2"])) story.append(Paragraph(f"Agency: {r['agency']}", styles["Normal"])) story.append(Paragraph(f"Title: {r['title']}", styles["Normal"])) story.append(Paragraph(f"URL: {r['url']}", styles["Normal"])) story.append(Paragraph( f"Retrieved: {r['timestamp']}", styles["Normal"] )) story.append(Spacer(1, 10)) exhibit_num += 1 story.append(Spacer(1, 20)) story.append(Paragraph( "All exhibits link to official FOIA electronic reading rooms.", styles["Italic"] )) doc.build(story) buffer.seek(0) return buffer