Automatic name tag generation, SVG to PDF

Text-based Open Formats are wonderful. SVG has been acclaimed last week, and here is yet another reason to like and use it.

I needed to generate (many) name tags for the legal workshop – expecting hours of name copy-pasting, my least loved task ever. The template SVG file was in Inkscape, and I had no idea how to automate this time consuming process.


Luckily, I have extremely kind friends. Here is what we did:

  • Create a template SVG with the design (it’s a full A4, folded to only show the names as on the pic above).
  • Add some text (unique if possible, we used xyz1, xyz2 and xyz3) exactly where you expect the name, position and organisation of your participants to be.
  • Create a pretty CSV file with one participant’s data per row. For example:

“Lucile F********”,”French Team”,”Free Software Foundation Europe”

  • Open your SVG file in a text editor ( We CAN do it! Beautiful open formats )
  • Search for your strings (xyz1, 2 and 3 in my case).
  • Write a script to automatically replace those strings with the data in your CSV file, rename the files and save them as PDF.
  • Run your script. You’re done!

Of course, the “write a script” part of the plan took a lot of time, mostly because I wanted to understand and be able to redo it. According to my friend, with some experience the whole process should not take more than half an hour.

I traded hours of boring copy-pasting for hours of thrilling python courses! It was a good deal, and I have a new reason to celebrate Open Standards, less than a week after Document Freedom Day.

Comments are closed.