###Working as of 30th September 2021.
Let's anyone create and email as many certificates in a fraction of time with just small input to specify where to print the names, data, etc. I have writen a step-by-step process to help run this code with minimal changes in the code - as the certificate will change person to person and so will the code. It's a simple code, for anyone even without a python background to run and implement. There are two codes available:
- Create Certificate Only - BulkCertMaker.py - Medium Blog Here + All Steps written below as well.
- Create Certificate and Email - BulkCertMaker - With Email.py - Medium Blog Here
Let's you align where your text goes on the Certificate Template. Also, automatically then send the email using your specified E-Mail.
It's a basic python program based on the Pillow Module to create bulk certificates for any event. Most softwares available online render a low quality certificate. It only requires you to make two changes
- Update the excel sheet with your names for the Certificate.
- Update where in the certificate should the name be printed.
Making it as detailed as possible so even a beginner can complete this process. Hence, if you aren't new to python just skip the steps.
- STEP 1: Setting up IDE (Here, PyCharm is being used)
- STEP 2: Installing the modules
- STEP 3: Setting up your Certificate
- STEP 4: Setting up your Excel Sheet
- STEP 5: Setting up the position where you want the name to be printed.
- STEP 6: Get all your certificates.
You can use any IDE for running the code - I prefer PyCharm for it's UI and the in-built terminal and consoles.
In this code, when initially runned it will result in an error if the following modules are not installed
- Pillow
- pandas
We use Pillow for manipulating our image, while we use pandas to access our data from the excel sheet.
pip install Pillow
pip install pandas
You can run the command in the Terminal in the folder where the file/code is. Ensure you match the case to not result in an error. If it's already installed you'll get a message like this:
You can always check your installed modules in your PyCharm IDE using: File>Settings>Project
Ensure you add your JPG File into the folder and rename the file name in the code, to match your certificate's name.
Ensure you add your Excel File into the folder and rename the file name in the code, to match your file name.
Open your certificate image in Paint to get the pixel co-ordinates. We need 4 values, x1, x2, y1, y2. This is the text-field dimension where the name will get printed. You can later align it to left, center and right. The coordinates are on the left hand side, bottom corner.
NOTE: x1, y1 is left corner while x2, y2 is the right corner.
If it is not in pixels for you, go to the properties page of Paint and change it to pixel:
Once you have your coordinate of the file go to Line 24 of the code and add your values:
As you can see you can also change the values of the font size, and the font style. It will take a few tries for you to get the alignment you want. You can also change it's alignment of text here:
Once, you are done with everything simply run the program. The code will automatically save all the certificates to the same folder as the program.
I really suggest using https://cloudconvert.com/ to convert any PDF file of the certificate template to the PNG File - It let's you control the DPI which further ensures your quality is good for the final certificate that is made.
Check my medium blog for step by step guide on how to even email these certificates - Here.
Let me know if there are any other issues you face or any code improvement suggestions one may have.