-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreports.py
More file actions
21 lines (17 loc) · 712 Bytes
/
reports.py
File metadata and controls
21 lines (17 loc) · 712 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/env python3
from reportlab.platypus import SimpleDocTemplate
from reportlab.platypus import Paragraph, Spacer
from reportlab.lib.styles import getSampleStyleSheet
def generate_report(attachment: str, title: str, paragraph: str) -> None:
"""
Creates a pdf report.
:param attachment: name (path) of pdf report to be created
:param title: title of pdf report
:param paragraph: body of pdf report
"""
styles = getSampleStyleSheet()
report = SimpleDocTemplate(attachment)
report_title = Paragraph(title, styles["h1"])
report_info = Paragraph(paragraph, styles["BodyText"])
empty_line = Spacer(1, 20)
report.build([report_title, empty_line, report_info])