Generate conference badges from a background image and a list of participants.
The script creates a PDF file containing printable badges arranged on A4 pages.
- Generate multiple badges from a custom background image
- Read participant names from a tab-separated text file
- Automatically center first names and last names
- Wrap long last names over multiple lines
- Export badges as a printable PDF file
The project requires:
- pandas
- Pillow
- reportlab
Clone the repository:
git clone https://github.com/parisepigenetics/badge_generator.git
cd badge_generatorCreate the conda environment:
conda env create -f environment.ymlActivate the environment:
conda activate badgesAlternatively, you can run the script without activating the environment:
conda run -n badges python badges.py --helpReplace background.png with your own badge background image.
The generated badges use the following dimensions:
- Width: 86 mm
- Height: 54 mm
The background image should ideally have the same aspect ratio as the final badge.
Replace participants.txt with your participant list.
The file must be a tab-separated text file (TSV) with a header line:
NOM Prénom
DUPONT Jean
MARTIN Alice
DOE John
Requirements:
- One participant per line
- Last name and first name separated by a tab character
- Keep the header names exactly as shown:
NOMPrénom
Generate a PDF containing all badges:
conda run -n badges python badges.py \
-p participants.txt \
-t background.png \
-o badges.pdfor:
conda activate badges
python badges.py \
-p participants.txt \
-t background.png \
-o badges.pdfThe output file badges.pdf can then be printed on A4 sheets.
GNU General Public License GPL-3.0