-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
30 lines (27 loc) · 987 Bytes
/
main.py
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
from fpdf import FPDF
import pandas as pd
pdf = FPDF(orientation="P", unit="mm", format="A4")
pdf.set_auto_page_break(auto=False, margin=0)
csv = pd.read_csv("topics.csv")
for index, row in csv.iterrows():
pdf.add_page()
# Set the headers
pdf.set_font(family="Times", style="B", size=24)
pdf.set_text_color(100, 100, 255)
pdf.cell(w=0, h=12, txt=row["Topic"], align="L", ln=1)
for i in range (20, 300, 10):
pdf.line(10, i, 200, i)
# Set the footers
pdf.ln(265)
pdf.set_font(family="Times", style="I", size=8)
pdf.set_text_color(180, 180, 180)
pdf.cell(w=0, h=10, txt=row["Topic"], align="R")
for i in range(int(row["Pages"] - 1)):
pdf.add_page()
pdf.ln(280)
pdf.set_font(family="Times", style="I", size=8)
pdf.set_text_color(180, 180, 180)
pdf.cell(w=0, h=10, txt=row["Topic"], align="R")
for i in range (20, 300, 10):
pdf.line(10, i, 200, i)
pdf.output("output.pdf")