This documentation refers to an older version of CiviCRM (3.4 / 4.0). View latest version.

Comparaison des versions


  • Ces lignes ont été ajoutées. Ce mot a été ajouté.
  • Ces lignes ont été supprimées. Ce mot a été supprimé.
  • Formatting was changed.
Commentaire: Migrated to Confluence 4.0

The simpliest, and easiest, configuration on the badges is to change the background image (by default, it's a civicrm logo).

To do that, you simply have to set up a custom template directory, and add a logo (png format) in the directory templates/CRM/Event/Badge/CRM_Event_Badge_Logo.png or /CRM/Event/Badge/CRM_Event_Badge_NameTent.png (respectively for the Logo or name tent format).

You can also set a specific logo for a specific event by putting the logo into templates/CRM/Event/Badge/[event id]/[class name].png

eg for the Logo format of the event number 42, simply put the image  templates/CRM/Event/Badge/42/CRM_Event_Badge_Logo.png

You might want to create a new format, simply go to the admin ( and create a new event badge.

You will have to provide a class that formats each badge. For instance, the Logo template CRM/Event/Badge/Logo.php contains two methods: the constuctor, that mostly sets the format of the page (how many badges per page), and generateLabels, that format each label.

$participant contains the datas about the participant (name, oganization, role...)

Bloc de code
class CRM_Event_Badge_Logo extends CRM_Event_Badge {

     function __construct() {
      $pw=210; $ph=297;// A4
      $h=50; $w=75;
      $this->format = array('name' => 'Sigel 3C', 'paper-size' => 'A4', 'metric' => 'mm', 'lMargin' => ($pw-$w*2)/2,
                              'tMargin' => ($ph-$h*5)/2, 'NX' => 2, 'NY' => 5, 'SpaceX' => 0, 'SpaceY' => 0,
                              'width' => $w, 'height' => $h, 'font-size' => 12);
      $this->lMarginLogo = 20;
      $this->tMarginName = 20;
//      $this->setDebug ();

   public function generateLabel($participant) {
     $x = $this->pdf->GetAbsX();
     $y = $this->pdf->GetY();
     $this->printBackground (true);
     $this->pdf->SetLineStyle(array('width' => 0.1, 'cap' => 'round', 'join' => 'round', 'dash' => '2,2', 'color' => array(0, 0, 200)));

      $this->pdf->MultiCell ($this->pdf->width-$this->lMarginLogo, 0, $this->event->title ,$this->border,"L",0,1,$x+$this->lMarginLogo ,$y);

     $date = CRM_Utils_Date::customFormat($this->event->start_date, "%e %b");
     $this->pdf->Cell ($this->pdf->width, 0, $date ,$this->border,2,"R");

     $this->pdf->MultiCell ($this->pdf->width,10, $participant['first_name']. " ".$participant['last_name'] ,$this->border,"C",0,1,$x ,$y+$this->tMarginName);
     $this->pdf->MultiCell ($this->pdf->width, 0, $participant['current_employer'] ,$this->border,"C",0,1,$x,$this->pdf->getY());


If you create a new format, please share it with the community and add it as a sub page below.

In theory, you can use a jpg or gif format. It did work much better with png in my case, YMMV.