This script was used to generate the badges for the convention. Uses Pretix API to pull details, then edits a svg template (made with inkscape) and renders to pdf, ready to be printed with a Zebra card printer or similar.
Go to file
Foxo 41de28fae4 Added readme.md 2023-07-11 19:39:59 +00:00
flags Initial commit. 2023-07-11 21:32:10 +02:00
avatar.png Initial commit. 2023-07-11 21:32:10 +02:00
badge_azzurro.png Initial commit. 2023-07-11 21:32:10 +02:00
badge_giallo.png Initial commit. 2023-07-11 21:32:10 +02:00
badge_rosso.png Initial commit. 2023-07-11 21:32:10 +02:00
badge_verde.png Initial commit. 2023-07-11 21:32:10 +02:00
badge_viola.png Initial commit. 2023-07-11 21:32:10 +02:00
ext.py Initial commit. 2023-07-11 21:32:10 +02:00
flag.svg Initial commit. 2023-07-11 21:32:10 +02:00
gen_badges.py Initial commit. 2023-07-11 21:32:10 +02:00
readme.md Added readme.md 2023-07-11 19:39:59 +00:00
template.svg Initial commit. 2023-07-11 21:32:10 +02:00

readme.md

Badge Generator

Editing hundreds of badges by hand was a tedious and time consuming project, so it was automated with this script.

Why not the Pretix badge generator?

Pretix badge generator was particularly hard to use and special cases (like the custom background based on role) was pretty much impossible.

How does this work?

The script "gen_badges.py" will:

  1. Fetch all orders from the pretix api
  2. Fetch details from each order, and use it to edit a SVG template. Rather than using XML libraries, everything is done with python built-in ".replace()" function with no regards on potential XML corruption.
  3. Render all the resultant SVG files to PDF (using inkscape)
  4. Merge all the separate PDF files to a combined one (using pdfmerge)

How do i create the template?

Just use Inkscape and then manually edit the paths of the *.svg file or find out how to replace them. Make sure to "vacuum document" and "export as a regular SVG" so that the file is simpler and easier to edit.