File size: 760 Bytes
7b31d98
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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