-
Notifications
You must be signed in to change notification settings - Fork 42
Add certificate automation #617
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
khairahscorner
merged 5 commits into
Women-Coding-Community:main
from
Sowmiya07:certificate-automation
Jan 4, 2026
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
9e9d804
Add certificate automation
Sowmiya07 458900e
Move certificate automation under tools
Sowmiya07 da27b70
Add tests to certificate automation
Sowmiya07 afe9395
Add warning to usage
Sowmiya07 47916a3
Refactor code to handle missing powerpoint gracefully
Sowmiya07 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,148 @@ | ||
| # WCC Certificate Automation | ||
|
|
||
| Automated certificate generation from PowerPoint templates and converting them to PDF format using JSON configuration | ||
|
|
||
| > **⚠️ Warning: PDF conversion currently only works on Windows** | ||
| > The PDF export functionality uses Microsoft PowerPoint COM automation via `comtypes`, which is only available on Windows. On macOS and Linux, the script will generate PPTX files, but PDF conversion will not work. | ||
|
|
||
| ## Prerequisites | ||
|
|
||
| - Python 3.7 or higher | ||
| - Microsoft PowerPoint (required for PDF conversion on Windows) | ||
|
|
||
| ## Installation | ||
|
|
||
| Install required Python packages: | ||
| ```bash | ||
| pip install -r requirements.txt | ||
| ``` | ||
|
|
||
|
|
||
| #### Dependencies | ||
|
|
||
| - `python-pptx>=0.6.21`: PowerPoint file manipulation | ||
| - `comtypes>=1.1.14`: COM automation for PowerPoint | ||
|
|
||
|
|
||
|
|
||
| ## Project Structure | ||
|
|
||
| ``` | ||
| wcc_certificate_automation/ | ||
| ├── README.md # This file | ||
| ├── requirements.txt # Python dependencies | ||
| ├── src/ | ||
| │ ├── config.json # Main configuration file | ||
| │ └── generate_certificates.py # Main automation script | ||
| └── data/ | ||
| ├── input/ | ||
| │ ├── templates/ # PPTX template files | ||
| │ │ ├── mentee.pptx | ||
| │ │ └── mentor.pptx | ||
| │ └── names/ # Names text files | ||
| │ ├── mentees.txt | ||
| │ └── mentors.txt | ||
| └── output/ # Generated certificates | ||
| ├── ppts/ # Generated PPTX files | ||
| │ ├── mentee/ | ||
| │ └── mentor/ | ||
| └── pdfs/ # Generated PDF files | ||
| ├── mentee/ | ||
| └── mentor/ | ||
| ``` | ||
|
|
||
| ## Configuration | ||
|
|
||
| Edit `src/config.json` to customize certificate generation settings. | ||
|
|
||
| ### Config File | ||
|
|
||
| ```json | ||
| { | ||
| "certificate_types": [ | ||
| { | ||
| "type": "mentee", | ||
| "template": "../data/input/templates/mentee.pptx", | ||
| "names_file": "../data/input/names/mentees.txt", | ||
| "pdf_dir": "../data/output/pdfs/mentee/", | ||
| "ppt_dir": "../data/output/ppts/mentee/", | ||
| "placeholder_text": "Sample Sample", | ||
| "font_name": "Georgia", | ||
| "font_size": 59.5 | ||
| } | ||
| ] | ||
| } | ||
| ``` | ||
|
|
||
| - **type**: Certificate type identifier (e.g., "mentee", "mentor") | ||
| - **template**: Path to the PPTX template file | ||
| - **names_file**: Path to text file containing names (one per line) | ||
| - **pdf_dir**: Output directory for PDF certificates | ||
| - **ppt_dir**: Output directory for PPTX certificates | ||
| - **placeholder_text**: Text in template to be replaced with names | ||
| - **font_name**: Font to use for names | ||
| - **font_size**: Font size in points | ||
|
|
||
| ### Names Files | ||
|
|
||
| Create text files in `data/input/names/` with one name per line: | ||
|
|
||
| **Example** (`data/input/names/mentees.txt`): | ||
| ``` | ||
| John Smith | ||
| Jane Doe | ||
| Alice Johnson | ||
| ``` | ||
|
|
||
| ### Template Files | ||
|
|
||
| Create PPTX template files in `data/input/templates/` with text placeholder: | ||
|
|
||
| **Example** (`data/input/templates/mentee.pptx`): | ||
|
|
||
| ## Usage | ||
|
|
||
| Navigate to the `src` directory and run the main script: | ||
|
|
||
| ```bash | ||
| cd src | ||
| python generate_certificates.py | ||
| ``` | ||
|
|
||
| The script will automatically: | ||
| 1. Check for duplicate names in the input files | ||
| 2. Generate PPTX certificates for each person | ||
| 3. Verify all PPTX certificates were created | ||
| 4. Convert all PPTX certificates to PDF format | ||
| 5. Verify all PDF certificates were created | ||
| 6. Display summary statistics | ||
|
|
||
| ## Output Format | ||
|
|
||
| Generated certificate files are named using the person's name directly: | ||
| - PPTX: `data/output/ppts/mentee/John Smith.pptx` | ||
| - PDF: `data/output/pdfs/mentee/John Smith.pdf` | ||
|
|
||
| ## Sample Logs | ||
|
|
||
| ``` | ||
| Generating MENTEE mentee certificates at ../data/output/ppts/mentee/ | ||
| [1/68] Generated: ../data/output/ppts/mentee/John Smith.pptx | ||
| [2/68] Generated: ../data/output/ppts/mentee/Jane Doe.pptx | ||
| ... | ||
|
|
||
| Successfully generated 68/68 mentee certificates | ||
|
|
||
| Checking metrics MENTEE certificates | ||
|
|
||
| Expected certificates: 68 | ||
| Found certificates: 68 | ||
|
|
||
| All mentee certificates are present! | ||
|
|
||
| Generating MENTEE mentee certificates at ../data/output/pdfs/mentee/ | ||
| [1/68] Generated: ../data/output/pdfs/mentee/John Smith.pdf | ||
| ... | ||
|
|
||
| Type: mentee Total: 68 PPTX Generated: 68 PDF Generated: 68 | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| TestFN TestLN | ||
| FirstName LastName | ||
| TestFN TestLN | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| TestFN TestLN | ||
| FirstName LastName |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| python-pptx>=0.6.21 | ||
| comtypes>=1.1.14 |
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| { | ||
| "certificate_types": [ | ||
| { | ||
| "type": "mentee", | ||
Sowmiya07 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| "template": "../data/input/templates/mentee.pptx", | ||
| "names_file": "../data/input/names/mentees.txt", | ||
| "pdf_dir": "../data/output/pdfs/mentee/", | ||
| "ppt_dir": "../data/output/ppts/mentee/", | ||
| "placeholder_text": "Sample Sample", | ||
| "font_name": "Georgia", | ||
| "font_size": 59.5 | ||
| }, | ||
| { | ||
| "type": "mentor", | ||
| "template": "../data/input/templates/mentor.pptx", | ||
| "names_file": "../data/input/names/mentors.txt", | ||
| "pdf_dir": "../data/output/pdfs/mentor/", | ||
| "ppt_dir": "../data/output/ppts/mentor/", | ||
| "placeholder_text": "Sample Sample", | ||
| "font_name": "Georgia", | ||
| "font_size": 59.5 | ||
| } | ||
| ] | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.