Badges
Step 1: Install trml2pdf and sablotron
Install trml2pdf and sablotron.
You can install it on debian or ubuntu like this:
apt-get install python-trml2pdf sablotron
Step 2: Create an XML file called "staff.xml" with the list of people
Download a example of staff.xml here.
<?xml version="1.0" encoding="utf-8" standalone="no"?> <badges> <badge> <name> John Doe </name> <project> University of Beijing</project> </badge> <badge> <name> Andre Agassant </name> <project> Committee for European Foobars</project> </badge> <badge> <name> Pieter Foo </name> <project> Black Mad</project> </badge> </badges>
Step 3: Create an XSL file called "badges.xsl"
Download a example of badges.xsl here.
<?xml version="1.0" encoding="iso-8859-1"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format"> <xsl:template match="badges"> <document filename="badges.pdf"> <template pageSize="(21cm, 29.7cm)" leftMargin="1.5cm" rightMargin="1.5cm" topMargin="1.5cm" bottomMargin="1.2cm" title="EUPACO1 Badges" author="zoobab" allowSplitting="20"> <pageTemplate id="all"> <pageGraphics> <!-- <image x="3.0cm" y="1.25cm" width="9cm" height="1.2cm" file="pict/eupaco.png"/> <image x="13cm" y="1.25cm" width="9cm" height="1.2cm" file="pict/eupaco.png"/> <image x="3.0cm" y="7.75cm" width="9cm" height="1.2cm" file="pict/eupaco.png"/> <image x="13cm" y="7.75cm" width="9cm" height="1.2cm" file="pict/eupaco.png"/> <image x="3.0cm" y="14.25cm" width="9cm" height="1.2cm" file="pict/eupaco.png"/> <image x="13cm" y="14.25cm" width="9cm" height="1.2cm" file="pict/eupaco.png"/> <image x="3.0cm" y="20.75cm" width="9cm" height="1.2cm" file="pict/eupaco.png"/> <image x="13cm" y="20.75cm" width="9cm" height="1.2cm" file="pict/eupaco.png"/> --> </pageGraphics> <frame id="badge0" x1="1.7cm" y1="23.1cm" width="84mm" height="54mm"/> <frame id="badge9" x1="11.2cm" y1="23.1cm" width="84mm" height="54mm"/> <frame id="badge7" x1="1.7cm" y1="17.7cm" width="84mm" height="54mm"/> <frame id="badge8" x1="11.2cm" y1="17.7cm" width="84mm" height="54mm"/> <frame id="badge5" x1="1.7cm" y1="12.3cm" width="84mm" height="54mm"/> <frame id="badge6" x1="11.2cm" y1="12.3cm" width="84mm" height="54mm"/> <frame id="badge3" x1="1.7cm" y1="6.9cm" width="84mm" height="54mm"/> <frame id="badge4" x1="11.2cm" y1="6.9cm" width="84mm" height="54mm"/> <frame id="badge1" x1="1.7cm" y1="1.5cm" width="84mm" height="54mm"/> <frame id="badge2" x1="11.2cm" y1="1.5cm" width="84mm" height="54mm"/> </pageTemplate> </template> <stylesheet> <blockTableStyle id="title"> <blockFont name="Helvetica-BoldOblique"/> <size size="9.5"/> <blockAlignment value="RIGHT" start="1,0" stop="1,0"/> <lineStyle kind="LINEBELOW" start="0,0" stop="1,0"/> </blockTableStyle> <paraStyle name="name" fontName="Helvetica-Bold" fontSize="30" alignment="center" leading="27"/> <paraStyle name="project" fontName="Helvetica" fontSize="15" alignment="center" leading="15"/> </stylesheet> <story> <xsl:apply-templates select="badge"/> </story> </document> </xsl:template> <xsl:template match="badge"> <!-- <spacer length="0cm"/>--> <blockTable style="title" colWidths="4.4cm,4.4cm"> <tr> <td> HSF: Hacker Space Festival</td> <td></td> </tr> </blockTable> <spacer length="7mm"/> <para style="name"><xsl:value-of select="name"/></para> <spacer length="0.0cm"/> <xsl:apply-templates select="project"/> <nextFrame/> </xsl:template> <xsl:template match="project"> <spacer length="0.4cm"/> <para style="project"><i><xsl:value-of select="."/></i></para> </xsl:template> </xsl:stylesheet>
Step 4: Create badges
On the command line, type:
sabcmd badges.xsl staff.xml badges_tmp.rml
trml2pdf badges_tmp.rml > badges.pdf
You should have a file badges.pdf like this one.
Step 5: Improvements
You can also put a backgroung image, like it was done for FOSDEM badges here. See the original FOSDEM XSL file here.
TODO: put the HSF2009 background image at the right size.