This project provides an auto-alignment system for PowerPoint presentations generated from JSON data, and includes a FastAPI server for generating .pptx files from your JSON input. The system ensures that slide components (text, images, tables, charts, etc.) are automatically positioned on a grid to prevent overlaps and maintain a clean, professional layout.
NEW: PwC Branding Guidelines Integration - The system now includes full support for PwC brand standards, including proper font usage (Georgia for headlines/body, Arial for sub-headlines/labels), approved color palette, and strict typography rules (no italics).
This system enforces PwC's official branding guidelines for PowerPoint presentations:
| Component Type | Font Family | Size | Weight | Color | Alignment |
|---|---|---|---|---|---|
| Title | Georgia (serif) | 44pt | Bold | #FFFFFF on #E0301E background | Left |
| H2/Sub-headline | Arial (sans-serif) | 28pt | Bold | #000000 | Left |
| Body Text | Georgia (serif) | 18pt | Regular | #2D2D2D on #CCCCCC background | Left |
| Caption/Label | Arial (sans-serif) | 14-16pt | Regular | #2D2D2D | Left |
| Data Numbers | Arial (sans-serif) | 48pt+ | Bold | #E0301E | Center |
| Quote | Georgia (serif) | 20pt | Regular | #000000 | Left |
- Serif Font (Georgia): Use for Headlines, Body text, Quotes, and Data descriptions
- Replaces ITC Charter for PowerPoint/system applications
- Sans-serif Font (Arial): Use for Sub-headlines, Introductions, Labels, and Data numbers
- Replaces Helvetica Neue for PowerPoint/system applications
- Critical Rules:
- ✗ Never use italics (strict PwC rule)
- ✗ Don't use Helvetica Neue in headlines
- ✗ Don't set large data numbers in Georgia
- ✗ Don't apply letter spacing/tracking to type
Primary Colors:
- PwC Orange:
#E0301E(core brand color) - Black:
#000000(primary text color) - White:
#FFFFFF(text on orange backgrounds) - Web Black:
#2D2D2D(text on light backgrounds) - Light Grey:
#CCCCCC(body text box backgrounds)
Color Usage:
- Text is primarily BLACK or WHITE
- Use PwC Orange for:
- Title/Header backgrounds
- Large data numbers (text color)
- Accent elements
- White text on orange requires 18pt or larger (accessibility compliance - WCAG AA)
- Title boxes: Background
#E0301E, Text#FFFFFF, Font Georgia Bold 44pt - Body text boxes: Background
#CCCCCC, Text#2D2D2D, Font Georgia 18pt - Sub-headlines: No background, Text
#000000, Font Arial Bold 28pt
See Sample_PwC_Branded.json for a complete example of a PwC-branded presentation following all guidelines.
Core Branding Module: core/pwc_branding.py contains all branding constants and validation functions.
You can generate PowerPoint files from JSON using the provided FastAPI server.
api/v1/ppt_generator.py: FastAPI route for processing JSON and generating PPTX.services/ppt.py: Service layer for processing JSON and generating PPTX.utils/ppt_generator.py: Core rendering logic for converting JSON to PPTX.utils/ppt_generator_main.py: Validation and auto-alignment logic.schemas/ppt-json-schema.json: JSON schema for validating your input.requirements.txt: Required dependencies (includesfastapi,python-pptx, etc.).
-
Install dependencies:
pip install -r requirements.txt
-
Start the FastAPI server:
uvicorn main:app --reload
(If your FastAPI app is not named
app, adjust accordingly.) -
Send a POST request with your JSON:
- Endpoint:
POST /generate-ppt - Body: Your PowerPoint JSON (see schema for structure)
Example using
curl:curl -X POST "http://localhost:8000/generate-ppt" \ -H "Content-Type: application/json" \ --data-binary @your_presentation.json \ --output output.pptx
Or use Swagger UI at http://localhost:8000/docs for interactive API usage.
- Endpoint:
- The server receives your JSON, validates it against
schemas/ppt-json-schema.json. - It auto-aligns components to prevent overlaps (see
utils/ppt_generator_main.py). - The presentation is rendered to a
.pptxfile usingutils/ppt_generator.py. - The generated PowerPoint file is returned as a download.
ppt_generator.py: script that generates the needed PPT from normalized json.utils/json_validator.py: Core engine for detecting and resolving overlapping components.services/ppt.py: FastAPI service for PPTX generation from JSON.
- Overlap Detection: Identifies and resolves overlapping components.
- Auto-Alignment Strategies: Choose from
preserve_order,compact, orbalanced. - Grid System Support: Honors grid, margins, and gutters from your JSON tokens.
- Validation & Reporting: Ensures no overlaps remain and reports layout statistics.
- Prepare your JSON file (see
schemas/ppt-json-schema.jsonfor structure). - Start the FastAPI server as above.
- POST your JSON to
/generate-pptand receive a.pptxfile.