This project is a Python-based certificate generator that automatically creates personalized certificates for a list of participants provided in an Excel file. By using a customizable certificate template and participant data, this script can generate certificates as PDF files, which can be easily shared or printed.
The goal of this project is to automate the process of creating certificates for participants, saving time and reducing manual effort. The project reads participant names from an Excel file, formats them appropriately, and adds them to a pre-designed certificate template.
- fonts/: Stores the font file used to render the participant's name on the certificate.
- template/: Contains the certificate template image in PNG format.
- output/: The script will save generated certificates in this directory.
- name_list.xlsx: Excel file containing a list of participant names in a column titled "Name".
- create.py: The main script that reads data, formats text, and generates the certificates.
- Load Excel Data: The script reads names from
name_list.xlsxin the "Name" column. - Load Template and Fonts: A certificate template (
certificate_template.png) and a custom font (CanvaSans-BoldItalic.ttf) are loaded for text rendering. - Generate Certificates: For each participant:
- The script centers the participant’s name on the template image.
- The modified image is saved as a PDF file in the
outputdirectory.
- Save as PDF: Each certificate is saved with the participant's name as the filename.
Ensure that you have Python installed (preferably 3.x) and the following libraries:
Install these dependencies by running:
pip install pandas pillow
- Clone this repository:
git clone https://github.com/IshanHansaka/certificate-generator.git cd certificate-generator
- Place the certificate template image in the
template/directory. - Add your custom font file to the
fonts/directory. - Create or update
name_list.xlsxin the root directory with participant names under the "Name" column.
- Font and Color: You can modify the
font_colorandfont_sizevariables in the script to adjust the appearance of the text on the certificate. - Template Dimensions: Update
template_widthandtemplate_heightin the script if your certificate template has different dimensions. - Text Positioning: Adjust the
name_x_positionandname_y_positionvariables or modify they_offsetin the script to control the text box's exact X and Y positions on the certificate template.