Skip to content

Commit e65affe

Browse files
Implemented the Bulk Certificate Generator using Python.
1 parent 5b7ccbb commit e65affe

File tree

12 files changed

+87
-0
lines changed

12 files changed

+87
-0
lines changed
730 KB
Loading
776 KB
Loading
773 KB
Loading
777 KB
Loading
786 KB
Loading
150 KB
Binary file not shown.
75.7 KB
Binary file not shown.
38.3 KB
Binary file not shown.
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
### Bulk Certificate Generator
2+
This Script is used to generate large number of certificates in a short period of time. This tool is very handy for the event organizers.
3+
4+
### Setup
5+
1. Create a Virtual Environment.
6+
2. Install the requiremnts by using `pip3 install -r requiremnts.txt`
7+
3. Hurray.! You're ready to use the Script.
8+
9+
### Prerequisites
10+
1. You need to develop your own template on your favourite design tool like figma, Adobe Xd, Sketch etc. and place your certificate template in the certificate template folder.
11+
2. Once the template is ready, Please calculate the coordinates using the design tool for writing the candidate name and certificate Id.
12+
3. If you want to change the fonts download the font files in .tff format and place it inside the fonst folder.
13+
4. Change the fonts on the script with your new fonts the Boom.! The script will automatically generate the certificates.
14+
5. Place your names excel file in the data folder.
15+
16+
### Running a file
17+
`python3 app.py`
18+
19+
### Generated Certificates using this tool
20+
21+
<img src="Certificates/Aravind Medamoni.jpg">
22+
23+
<hr>
24+
25+
<img src="Certificates/Sai Vardhan Poloju.jpg">
26+
27+
<hr>
28+
29+
<img src="Certificates/Arun Sai Reddy.jpg">
30+
31+
<hr>
32+
33+
<img src="Certificates/Sri Manikanta Palakollu.jpg">
34+
35+
<hr>
36+
37+
### Note
38+
You need to change the some setting according to your template requirement. But it work absolutely fine if you follow the above th guidelines properly.

Bulk Certificate Generator/app.py

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
__author__ = 'Sri Manikanta Palakollu'
2+
__date__ = '27-07-2020'
3+
4+
from PIL import Image, ImageDraw, ImageFont
5+
import pandas as pd
6+
import random
7+
8+
# y_coordinate = 1020
9+
y_coordinate = int(input('Enter the Y-cordinate value to write the name: '))
10+
template_name = input("Enter your custom template name: ")
11+
data_file = input('Enter your names file name: ')
12+
13+
try:
14+
df = pd.read_excel('data/{}'.format(data_file))
15+
names = list(df['Name'].values)
16+
except ValueError:
17+
print("There is a value error in the Dataframe please check the value")
18+
19+
try:
20+
for name in names:
21+
22+
certificateId = "SICET" + str(random.randint(45765654, 99765957))
23+
name = name.rstrip()
24+
25+
# Change the certificate name According to yours
26+
img = Image.open("Certificate_Template/{}".format(template_name))
27+
width, height = img.size
28+
draw = ImageDraw.Draw(img)
29+
30+
# Customize the Font Size based on your requirement.
31+
font = ImageFont.truetype("Fonts/BirdsOfParadise.ttf", 200)
32+
offset = 20
33+
x_coordinate = int(width / 2 - font.getsize(name)[0] / 2) + offset
34+
draw.text((x_coordinate, y_coordinate), name, (238, 33, 33), font=font)
35+
id_font = ImageFont.truetype("Fonts/lesser_concern.ttf", 90)
36+
draw.text((190, 2250), "ID: ", (0, 0, 0), font=id_font)
37+
38+
# Writing the Certificate Id
39+
draw.text((290, 2250), certificateId, (0, 0, 0), font=id_font)
40+
41+
# Signature Content
42+
draw.text((1500, 2250), "Hackathon Intiator", (0, 0, 0), font=id_font)
43+
img.save("Certificates/" + str(name) + ".jpg")
44+
print("Certificate Created for {}".format(name))
45+
except Exception:
46+
print('Something went wrong.!')

0 commit comments

Comments
 (0)