Skip to main content

Generate PDF attendance certifications, ready to email, on the command line or in a batch from a CSV file.

Project description

Certify - Certificate Generator

A flexible, reusable Python tool to generate personalized PDF certificates for course attendees using ReportLab.

Primarily designed for South Thames Paediatric Endocrine Group (STPEG), but built to be customizable for any organization.

Features

  • โœจ Generate professional PDF certificates from command line
  • ๐Ÿ“ Customizable organizer name and logo
  • ๐ŸŽจ Professional styling with organization branding
  • ๏ฟฝ Automatic folder organization by year and event
  • ๏ฟฝ๐Ÿ”ง Easy-to-use interactive mode
  • ๐Ÿ“ฆ Built with ReportLab for high-quality PDF output
  • ๐Ÿ”„ Fully reusable - designed for any organization

Sample Certificate

Here's an example of a generated certificate for Dr Simon Chapman attending the STPEG Autumn Meeting 2025:

Sample Certificate

See the full PDF sample for the complete certificate.

Setup

This project uses uv as the Python package manager for fast, reliable dependency management.

Prerequisites

  • Python 3.13+
  • uv (install via: curl -LsSf https://astral.sh/uv/install.sh | sh)

Installation

  1. Clone the repository:

    git clone https://github.com/eatyourpeas/Certify.git
    cd Certify
    
  2. Activate the environment:

    source ~/.local/bin/env
    source .venv/bin/activate
    
  3. Dependencies are already installed:

    • reportlab - PDF generation
    • pillow - Image processing

Usage

Interactive Mode (Recommended)

uv run python generate_certificate.py

You will be prompted to enter:

  • Event name - Name of the course/conference
  • Event year - Year (defaults to current year)
  • Organiser name - Organization hosting the event (defaults to "South Thames Paediatric Endocrine Group")
  • Organiser logo - Path to PNG logo file (defaults to "logo.png")
  • Attendee's name - Name of the certificate recipient
  • Course/event title - Title of the course attended
  • Location - Where the event took place
  • Date - Event date (e.g., "27th May 2024")
  • Host hospital - Hospital name (optional, for institutional context)
  • Host trust - NHS trust name (optional, for institutional context)
  • Host name - Individual organizer (e.g., "Dr Charlotte Jackson") (optional)
  • Output filename - Where to save the certificate (optional, auto-generated from attendee name)

Programmatic Mode

Use the create_certificate() function in your own scripts:

from main import create_certificate

output_file = create_certificate(
    attendee_name="Jane Doe",
    course_title="Endocrinology Workshop",
    location="Royal Alexandra Children's Hospital",
    date="27th May 2024",
    organiser="Your Organization Name",
    organiser_logo="path/to/your/logo.png",
    host_hospital="Kingston Hospital",
    host_trust="NHS Trust",
    host_name="Dr John Smith",
    output_path="jane_doe_certificate.pdf"
)

print(f"Certificate saved to: {output_file}")

Batch Mode (CSV / TXT)

Generate certificates for many attendees at once using batch_generate.py.

CSV: By default the importer is optimised for EventBrite exports โ€” it recognises the exact column names Attendee first name and Attendee Surname (including casing and spaces). It will also accept common single-column name headers such as name, full_name, or attendee_name.

Additional per-row override columns are supported: output_filename, host_name, organiser, organiser_logo, course_title, location, date, host_hospital, host_trust.

TXT: a simple newline-separated list of attendee names.

Example (EventBrite CSV):

python batch_generate.py --input attendees.csv \
   --event-name "STPEG Autumn Meeting" \
   --course-title "STPEG Autumn Meeting 2025" \
   --location "Brighton" \
   --date "27th May 2025" \
   --zip

If your CSV uses different column names you can override the field mapping:

python batch_generate.py --input attendees.csv \
   --first-name-field "Given Name" --surname-field "Family Name" \
   --event-name "STPEG Autumn Meeting" --course-title "..." --location "..." --date "..."

The script creates a folder named <year>_<eventname> and writes one PDF per attendee. Use --zip to create a ZIP archive containing all generated certificates.

Email preparation

batch_generate.py can also prepare email jobs for each attendee so an external service or web layer can send them. By default the importer recognises the EventBrite export columns Attendee first name, Attendee Surname and Attendee email and will map email addresses to generated certificate files.

CLI flags:

  • --email-field (default: Attendee email) โ€” CSV column to read recipient addresses from.
  • --prepare-emails โ€” prepare and print a list of email jobs mapping recipient -> certificate file (does not send).

Behaviour notes:

  • generate_batch() returns a dict including email_jobs, an array of simple objects with the keys: recipient, name, filepath, subject, body, and meta. This is intended to be consumed by a service layer (FastAPI/Flask) responsible for sending.
  • Duplicate attendees are deduplicated (one certificate generated) and the run summary logs duplicates and skipped rows.
  • Sending emails is intentionally left to the consuming service. Implementations can use SMTP, Microsoft Graph, or platform-specific adapters to send or create drafts.

Example: prepare email jobs (no send)

python batch_generate.py --input attendees.csv \
   --event-name "STPEG Autumn Meeting" \
   --course-title "STPEG Autumn Meeting 2025" \
   --location "Brighton" \
   --date "27th May 2025" \
   --prepare-emails

Quick Test

To test with default STPEG values:

uv run python main.py

This generates certificate_sample.pdf with example data.

Customization

For Different Organizations

  1. Logo Setup:

    • Place your organization's logo as a PNG file in the project directory
    • Use any filename (pass the path to organiser_logo parameter)
    • Recommended size: At least 500ร—500 pixels for best quality
  2. Default Values:

    • Change the defaults in main.py function parameters
    • Or specify custom values every time via interactive mode
  3. Certificate Appearance: Edit main.py to customize:

    • Colors: Line 35 (org_color = colors.HexColor("#003366"))
    • Fonts: Lines 34-35
    • Layout/positioning: Adjust the inch values in draw functions
    • Border style: Lines 41-44

Example: Using a Different Logo

uv run python generate_certificate.py
# When prompted:
# Organiser logo: /path/to/my_logo.png

Example: Using for a Different Organization

uv run python generate_certificate.py
# When prompted:
# Event name: AI Workshop 2024
# Organiser name: TechCorp Training Institute
# Organiser logo: techcorp_logo.png
# ... continue with other details

File Organization

Certificates are automatically organized into folders by year and event name:

Certify/
โ”œโ”€โ”€ 2024_STPEG_Training_Conference/
โ”‚   โ”œโ”€โ”€ michael_rogers.pdf
โ”‚   โ”œโ”€โ”€ sarah_mitchell.pdf
โ”‚   โ””โ”€โ”€ ...
โ”œโ”€โ”€ 2024_Advanced_Workshop/
โ”‚   โ”œโ”€โ”€ jane_doe.pdf
โ”‚   โ””โ”€โ”€ ...
โ””โ”€โ”€ main.py

Project Structure

Certify/
โ”œโ”€โ”€ main.py                    # Core certificate generation function
โ”œโ”€โ”€ generate_certificate.py    # Interactive CLI tool
โ”œโ”€โ”€ pyproject.toml            # Project configuration & dependencies
โ”œโ”€โ”€ uv.lock                   # Locked dependency versions
โ”œโ”€โ”€ logo.png                  # Default STPEG logo (customize for your organization)
โ”œโ”€โ”€ LICENSE                   # MIT License
โ”œโ”€โ”€ README.md                 # This file
โ””โ”€โ”€ [year_eventname]/         # Auto-generated folders for organized certificates
    โ””โ”€โ”€ certificates.pdf

Project Management with uv

Install a New Dependency

uv add package_name

Run a Script

uv run python script.py

Sync Environment

uv sync

Troubleshooting

uv command not found

Ensure uv is in your PATH:

source ~/.local/bin/env

Add to your shell profile (~/.zshrc or ~/.bashrc):

export PATH="$HOME/.local/bin:$PATH"

Logo not displaying

  • Ensure the PNG file exists at the specified path
  • Check file permissions (should be readable)
  • Verify the file is a valid PNG image
  • Use absolute paths if relative paths don't work

Module not found errors

Make sure you're using uv run:

uv run python generate_certificate.py

Or activate the virtual environment:

source .venv/bin/activate
python generate_certificate.py

Next Steps

  • โœ… Customize the organiser and organiser_logo for your organization
  • ๐ŸŒ Build a web interface with Flask or FastAPI
  • ๐Ÿ’พ Integrate with a database for auto-generating certificates on course completion
  • ๐Ÿ“ง Add email functionality to automatically send certificates to attendees

Defaults (STPEG Configuration)

This tool is optimized for South Thames Paediatric Endocrine Group with the following defaults:

  • Organiser: South Thames Paediatric Endocrine Group
  • Logo: logo.png
  • Host Hospital: Royal Alexandra Children's Hospital
  • Host Trust: Brighton & Sussex University Hospitals

All parameters can be overridden for use with other organizations.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Support

For issues, feature requests, or to adapt this for your organization, please reach out through GitHub.


Made with โค๏ธ for STPEG and shared for the community

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

certify_attendance-0.1.2.tar.gz (13.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

certify_attendance-0.1.2-py3-none-any.whl (13.8 kB view details)

Uploaded Python 3

File details

Details for the file certify_attendance-0.1.2.tar.gz.

File metadata

  • Download URL: certify_attendance-0.1.2.tar.gz
  • Upload date:
  • Size: 13.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for certify_attendance-0.1.2.tar.gz
Algorithm Hash digest
SHA256 9716c2658ffc1d064a935c1fbba5c933bbe099e0296d9ce59692f4c7f3c7a6c8
MD5 3c21f6099b6dbf0fa215ceb8639a226b
BLAKE2b-256 f84db2fe8b3ccfede9f28e1f49907d77ce7fe3e6241600d0969336b2a1b123b5

See more details on using hashes here.

File details

Details for the file certify_attendance-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for certify_attendance-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a7d0d935416c07c8269749b3d97da1058984ffb0dd96487ea882795fda930bd5
MD5 ebe8e8463d70752dc101c7d511343900
BLAKE2b-256 4b0a226abde215824f2093cbc1900fe3094aeceac6a003c9c186d38a1ae5f2d3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page