Skip to content

Commit c16594e

Browse files
committed
L08E03
1 parent b93b7ce commit c16594e

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
from fpdf import FPDF
2+
3+
4+
class PDF(FPDF):
5+
def __init__(self, name):
6+
super().__init__(
7+
orientation="P", # page orientation: portrait (default)
8+
format="A4", # page format A4 (default)
9+
)
10+
self.add_page()
11+
self.set_font("helvetica", "B", 30)
12+
self.cell(0, 50, txt="CS50 Shirtificate", new_x="LMARGIN", new_y="NEXT", align="C")
13+
self.image("shirtificate.png", w=self.epw) # epw = effective page width
14+
self.set_font_size(20)
15+
self.set_text_color(255, 255, 255)
16+
self.text(x=65, y=125, txt=f"{name} took CS50")
17+
self.output("shirtificate.pdf")
18+
19+
20+
def main():
21+
PDF(input("Name: "))
22+
23+
24+
if __name__ == "__main__":
25+
main()
26+

0 commit comments

Comments
 (0)