Spaces:
Sleeping
Sleeping
| from reportlab.platypus import SimpleDocTemplate, Paragraph | |
| from reportlab.lib.styles import getSampleStyleSheet | |
| import tempfile | |
| def generate_foia_packet(agency, subject): | |
| styles = getSampleStyleSheet() | |
| tmp = tempfile.NamedTemporaryFile(delete=False, suffix=".pdf") | |
| doc = SimpleDocTemplate(tmp.name) | |
| content = [ | |
| Paragraph("Freedom of Information Act Request", styles["Title"]), | |
| Paragraph(f"Agency: {agency}", styles["Normal"]), | |
| Paragraph(f"Subject: {subject}", styles["Normal"]), | |
| Paragraph( | |
| "This request is made under 5 U.S.C. § 552 for records " | |
| "maintained in public electronic reading rooms.", | |
| styles["Normal"] | |
| ) | |
| ] | |
| doc.build(content) | |
| return tmp.name |