This Python script generates certificates for a list of names provided in the name_list variable. The certificates are created by overlaying the names on a certificate template image using a specified font. The resulting certificates are saved as PDF files in the certificates directory.
Before running the script, ensure you have the following installed:
- Python 3.x
- Pillow library (PIL) for image processing: Install using
pip install Pillow
-
Prepare your certificate template:
- Ensure your certificate template is in a supported image format (e.g., PNG, JPEG).
- Name the template image file
cert.pngand place it in the same directory as the script.
-
Prepare your font file:
- Choose a TrueType font (TTF) file to be used for the names on the certificates.
- Name the font file
BRUSHSCI.TTF(or updatefont_pathvariable in the script) and place it in afontsdirectory in the same location as the script.
-
Modify the list of names:
- Open the script in a text editor and update the
name_listvariable with the names you want to generate certificates for.
- Open the script in a text editor and update the
-
Run the script:
- Open a terminal or command prompt and navigate to the directory containing the script.
- Run the script by executing
python script_name.py(replacescript_name.pywith the actual name of your Python script).
-
Generated Certificates:
- The generated certificates will be saved as PDF files in the
certificatesdirectory.
- The generated certificates will be saved as PDF files in the
- Ensure the font size and location settings in the script (
font_size,location) are appropriate for your certificate template. - Verify the color settings (
text_color) for proper visibility against the certificate background. - Test the script with a small set of names first to ensure the certificates are generated as expected.