-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
176 lines (142 loc) · 4.86 KB
/
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
import os
from unicodedata import name
from fpdf import FPDF
run = True
while run:
fname = input("Input Your Filename= ")
fname = f"./output/{fname}.pdf"
print("Your output location is:", fname)
if os.path.isfile(fname) and os.stat(fname).st_size != 0:
print ("Already Present in the directory")
continue
else:
print ("This is CV Builder")
name = input("Enter Your name: ")
pno = '+91' + input("Enter Your Mobile no.: ")
email = input("Enter your email: ")
adres = input("Enter your addrress: ")
dob = input("Enter your date of birth(dd/mm/yyyy): ")
objective = """To Secure a challenging position in a reputable organization to expand my learnings, knowledge, and skills Seeking an entry-level position to begin my career in a high-level professional environment."""
run = False
class PDF(FPDF):
#for header this will incluse on every page
'''def header(self):
self.set_draw_color(0,0,0)
self.image('pdflearning/image.jpg', 165, 15, 35, )
self.ln(8)'''
def footer(self):
self.set_y(-15)
self.set_x(100)
self.set_font('helvetica', '', 10)
self.set_text_color(100,50,100)
self.cell(10, 5, f'Page {self.page_no()}', align='c')
'''
def objective(self, name):
with open(name, 'rb') as fh:
txtfile = fh.read().decode('latin-1')
self.set_font('helvetica', '', 16)
self.multi_cell(190, 8, f'{txtfile}')'''
pdf = PDF('P', 'mm', 'A4') #(Orientation= 'L=Landscape','P=Potrait')
#add a page
pdf.add_page()
#add a font
pdf.set_font('helvetica', 'b', 21) #(Font, style, size)
#add ac color
pdf.set_text_color(162,0,37)
#add a image
iname = input("Input Your Profile Image Name(eg- image.png)= ")
iname = f"./image/{iname}"
if os.path.isfile(iname):
pdf.image(iname, 165, 15, 35, )
else:
iname = 'yourimage.jpg'
pdf.image(f'./image/{iname}', 165, 15, 35, )
pdf.ln(8)
#create a cell
pdf.cell(40, 10, f'Name: {name}', ln= True)
pdf.set_text_color(0,0,0)
pdf.set_font('helvetica', '', 16)
pdf.cell(100, 8, f'DOB: {dob}', ln=1)
pdf.cell(100, 8, f'Email: {email}', ln=1)
pdf.cell(100, 8, f'Mobile.No.: {pno}', ln=1)
pdf.cell(100, 8, f'Address: {adres}', ln=1)
pdf.ln(10)
#objective
pdf.set_font('helvetica', 'b', 21)
pdf.set_fill_color(134, 198, 244)
pdf.cell(40, 9,'Objective' , fill=1, border=0, ln= True)
pdf.set_font('helvetica', '', 16)
pdf.multi_cell(190, 8, f'{objective}', border=0)
pdf.ln()
#Qualification
pdf.ln()
pdf.set_font('helvetica', 'b', 21)
pdf.set_fill_color(134, 198, 244)
pdf.cell(55, 9, 'Qualifications' , fill=1, border=0, ln= True)
user = int(input("How many Qualifications do you have?= "))
dquali = {}
for i in range(1, user+1):
instring = f"Qualification{i} = "
quali = "quali%d" % i
dquali[quali] = f'{i}. ' + input(instring)
for i in range(1, user+1):
damn = "quali%d" %i
quali = dquali[damn]
print(quali)
pdf.set_font('helvetica', '', 16)
pdf.multi_cell(190, 8, f'{quali}', border=0)
#Skills
pdf.ln()
pdf.set_font('helvetica', 'b', 21)
pdf.set_fill_color(134, 198, 244)
pdf.cell(25, 9, 'Skills' , fill=1, border=0, ln= True)
user = int(input("how many skills do you have?= "))
dskill = {}
for i in range(1, user+1):
instring = f"Skill{i} = "
skill = "skill%d" % i
dskill[skill] = f'{i}. ' + input(instring)
for i in range(1, user+1):
damn = "skill%d" %i
skill = dskill[damn]
print(skill)
#Skills
pdf.set_font('helvetica', '', 16)
pdf.multi_cell(190, 8, f'{skill}', border=0)
#Hobbies
pdf.ln()
pdf.set_font('helvetica', 'b', 21)
pdf.set_fill_color(134, 198, 244)
pdf.cell(35, 9, 'Hobbies' , fill=1, border=0, ln= True)
user = int(input("How many Hobbies do you have?= "))
dhobby = {}
for i in range(1, user+1):
instring = f"Hobby{i} = "
hobby = "hobby%d" % i
dhobby[hobby] = f'{i}. ' + input(instring)
for i in range(1, user+1):
damn = "hobby%d" %i
hobby = dhobby[damn]
print(hobby)
pdf.set_font('helvetica', '', 16)
pdf.multi_cell(180, 8, f'{hobby}', border=0)
#Strengh
pdf.ln()
pdf.set_font('helvetica', 'b', 21)
pdf.set_fill_color(134, 198, 244)
pdf.cell(35, 9, 'Strength' , fill=1, border=0, ln= True)
user = int(input("How many Strength do you have?= "))
dstrength = {}
for i in range(1, user+1):
instring = f"Strength{i} = "
strength = "strength%d" % i
dstrength[strength] = f'{i}. ' + input(instring)
for i in range(1, user+1):
damn = "strength%d" %i
strength = dstrength[damn]
print(strength)
pdf.set_font('helvetica', '', 16)
pdf.multi_cell(190, 8, strength, border=0)
#pdf.cell(40, 8, f'{txtfile}', ln= True)
print("File Created at location: ", fname)
pdf.output(fname)