Skip to content

puneetdixit200/certificate-generator-

Repository files navigation

Certificate Generator

This repository contains a small Python workflow for generating named certificates from a background design and exporting a merged PDF of all generated files.

The current main flow is:

  1. Put recipient names in names.csv
  2. Use certificate.png as the certificate background
  3. Run crete.py to generate one PDF per name in generated_certificates/
  4. Run merge_generated_pdfs.py to combine them into a single PDF

Project Layout

  • crete.py: Main participant certificate generator using names.csv and certificate.png
  • merge_generated_pdfs.py: Merges generated PDFs into all_certificates.pdf
  • generate_volunteers.py: Alternate volunteer certificate flow based on a separate template and private volunteers_list.py
  • test_fonts.py: Produces a font sample PDF for checking ReportLab built-in fonts
  • names.csv: CSV input file for participant names
  • certificate.png: Background image used for the generated certificates
  • generated_certificates/: Output folder created by the generator

Requirements

  • Python 3.10+
  • reportlab
  • PyPDF2

Install dependencies:

pip install reportlab PyPDF2

Input Format

The participant generator expects a CSV file named names.csv with a Name column.

Example:

Name
John Doe
Jane Smith
Alex Kumar

Generate Participant Certificates

From this folder, run:

python crete.py

What it does:

  • Reads names from names.csv
  • Uses certificate.png as a full-page background
  • Draws each name centered on the page
  • Writes one PDF per recipient into generated_certificates/

Merge All Generated PDFs

After generating certificates, run:

python merge_generated_pdfs.py

This creates:

  • all_certificates.pdf

The merge step fails if generated_certificates/ does not exist or contains no PDFs.

Adjusting the Certificate Layout

The main layout settings live in crete.py:

  • FONT_NAME
  • FONT_SIZE
  • BACKGROUND_IMAGE
  • The computed x and y coordinates inside create_certificate()

Useful cases:

  • If names appear too low or too high, adjust the y position
  • If long names overflow, reduce FONT_SIZE
  • If you want a different template, replace certificate.png or point BACKGROUND_IMAGE to another file

Volunteer Certificates

generate_volunteers.py is a separate flow intended for volunteer certificates. It currently depends on files that are not committed to the repository:

  • volunteers_list.py
  • a PDF template under VOLUNTEERS/

Those files are ignored on purpose, so this script is only usable after you supply the required private inputs.

Ignored Files

The repository ignores generated outputs and private inputs such as:

  • generated_certificates/
  • volunteers/
  • VOLUNTEERS/
  • volunteers_list.py
  • PDF outputs

That keeps generated documents and sensitive source lists out of version control.

Troubleshooting

  • If no certificates are created, check that names.csv exists and contains a Name header
  • If names do not appear in the expected place, adjust the drawing coordinates in crete.py
  • If the background is missing, confirm that certificate.png exists in this folder
  • If merging fails, make sure generated_certificates/ contains valid PDF files

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages