This project generates a single PDF file containing employee ID cards, with one ID per page, using a pre-defined ID template image, a CSV file with employee data, and a directory of employee photos. Each ID card is sized to standard dimensions (3.375 x 2.125 inches), with the employee name at the bottom-left and a photo at the top-left.
- Generates a PDF with one employee ID per page.
- Uses a template image (
ute_id_template.png) for consistent ID design. - Reads employee data (name, title, photo path) from a CSV file.
- Places employee photos and text (name and title) on each ID.
- Name is positioned at the bottom-left with a font size of 10 points.
- Title is positioned at (1.7 inches x, 0.6 inches from bottom) with an 8-point font.
- Photo is positioned at (0.37 inches x, 0.33 inches from top) with a 1x1 inch size.
- Python: Version 3.8 or higher
- Libraries:
reportlab: For PDF generationpillow: For image processing
- Input Files:
ute_id_template.png: ID template image (1013x638 pixels for 3.375x2.125 inches at 300 DPI)employeesMetaData.csv: CSV file with columnsname,title,photo_path- Employee photos in
src/passportPhotos/(e.g.,employee1.jpg,employee2.jpg)
Install dependencies via:
pip install -r requirements.txt-
Clone the Repository:
git clone https://github.com/your-username/employee_id_generator.git cd employee_id_generator -
Set Up a Virtual Environment
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install Dependencies
pip install -r requirements.txt
-
Prepare Input Files
- Place
ute_id_template.pnginsrc/. - Place employee photos (e.g.,
employee1.jpg,employee2.jpg) insrc/passportPhotos/. - Create or update
src/employeesMetaData.csvwith the following format:
name,title,photo_path John,Software Engineer,employee1.jpg Siri,Project Manager,employee2.jpg Alice,Software Engineer,employee3.jpg Mary,Project Manager,employee4.jpg - Place
-
Navigate to the
src/directory:cd src -
Run the script:
python main.py
-
Check the output:
- A file named
employee_id_cards.pdfwill be generated insrc/. - Each page contains one ID card with the template, employee photo, name, and title.
- A file named