-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathextra_report.py
More file actions
33 lines (31 loc) · 1014 Bytes
/
extra_report.py
File metadata and controls
33 lines (31 loc) · 1014 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
from jinja2 import Environment, FileSystemLoader
# from weasyprint import HTML, CSS
import datetime
# def generate_content():
# templates_dir = "templates"
# env = Environment(loader=FileSystemLoader(templates_dir))
# template = env.get_template('template.html')
# filename = "Extended Reports/content.html"
# with open(filename, 'w') as fh:
# fh.write(template.render(
# var1=5,
# var2=7,
# h1="Hello Jinja2"
# ))
#
# pdf_template = env.get_template('pdf_template.html')
#
# filename = "archive/pdf_content.html"
# with open(filename, 'w') as fh:
# fh.write(pdf_template.render(
# h1="REPORT",
# h3="report data: ",
# date=datetime.datetime.now().strftime("%d-%m-%Y"),
# ))
#
# css = CSS(
# string='''
# @page {size:A4; margin:1cm;}
# '''
# )
# HTML('archive/pdf_content.html').write_pdf('Extended Reports/content.pdf', stylesheets=[css])