-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgenerator.py
More file actions
108 lines (45 loc) · 1.82 KB
/
generator.py
File metadata and controls
108 lines (45 loc) · 1.82 KB
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
# importing libraries
import pandas as pd
from PIL import Image, ImageDraw, ImageFont
import os
# reading csv
data = pd.read_excel(r'demo.xlsx', engine='openpyxl')
# remove null values
data.dropna(inplace=True,axis=1)
# dropping dupicate rows
data.drop_duplicates(subset=['Email'], keep='last', inplace=True)
# convert to list
names = data['Name'].to_list()
emails = data['Email'].to_list()
# checking if the directory exists
if os.path.exists('certificates'):
print("Folder already exists")
else:
os.mkdir('certificates')
# opening log file and writing ceritifcates
with open("logs.txt", 'a') as f:
for (name, email) in zip(names, emails):
file_path = 'ss1.png'
image = Image.open(file_path)
draw = ImageDraw.Draw(image)
(x, y) = (447, 390)
color = 'rgb(255,255,255)'
name = name
font = ImageFont.truetype('arial.ttf', size=60)
draw.text((x, y), name, fill=color, font=font)
cert_dir = 'certificates/'
cert_path = cert_dir+email+'.pdf'
image.save(cert_path)
print(str(email) + " Success")
f.write(str(email) + " Success")
f.write("\n")
f.close()
#- `git clone https://github.com/saadhaxxan/Certificate-Generator-Sender.git`
# - `cd Certificate-Generator-Sender`
# - Add `base_file.png` as your certificate file
# - Replace `demo.csv` with you own csv file that must have 2 columns of `Names` and `Emails`
# - Open up `generator.py` and add your own custom text for the certificate
# - Run command `python generator.py`
# - Open up `sender.py` and add your email credentials
# - Verify the certificates folder and then replace the subject and body of email with your own data
# - Run command `python sender.py`