function DrawBarcode($cb, $x, $y, $w, $h, $type = '')
 {
     $type = strToLower($type);
     $len = strlen($cb);
     // calcule la largeur du code barre en pixels
     switch ($type) {
         case 'c128a':
         case 'c128b':
         case 'c128c':
             $width = (35 + $len * 11) * $this->cbXRes;
             break;
         case 'i25':
             $width = (8 + $len * 7) * $this->cbXRes;
             break;
         case 'c39':
         default:
             $width = (($len + 2) * 12 + $len + 1) * $this->cbXRes;
             break;
     }
     // calcule la hauteur en pixels à partir de la largeur
     $height = $width * $h / $w;
     // crée le code barre
     switch ($type) {
         case 'c128a':
             $cbi = new C128AObject($width, $height, $this->cbStyle, "{$cb}");
             break;
         case 'c128b':
             $cbi = new C128BObject($width, $height, $this->cbStyle, "{$cb}");
             break;
         case 'c128c':
             $cbi = new C128CObject($width, $height, $this->cbStyle, "{$cb}");
             break;
         case 'i25':
             $cbi = new I25Object($width, $height, $this->cbStyle, "{$cb}");
             break;
         case 'c39':
         default:
             $cbi = new C39Object($width, $height, $this->cbStyle, "{$cb}");
             break;
     }
     // dessine et incorpore au pdf.
     $cbi->SetFont($this->cbFontSize);
     $cbi->DrawObject($this->cbXRes);
     $filename = FPDF_CB_TEMPPATH . "cb" . time() . $cb;
     $cbi->SaveTo($filename);
     $cbi->DestroyObject();
     $this->Image($filename, $x, $y, $w, $h, "png");
     unlink($filename);
 }