コード例 #1
0
ファイル: LabelCommon.php プロジェクト: hguru/224Civi
 /**
  * function to create labels (pdf)
  *
  * @param   array    $contactRows   assciated array of contact data
  * @param   string   $format   format in which labels needs to be printed
  * @param   string   $fileName    The name of the file to save the label in
  *
  * @return  null
  * @access  public
  */
 static function createLabel(&$contactRows, &$format, $fileName = 'MailingLabels_CiviCRM.pdf')
 {
     $pdf = new CRM_Utils_PDF_Label($format, 'mm');
     $pdf->Open();
     $pdf->AddPage();
     //build contact string that needs to be printed
     $val = NULL;
     foreach ($contactRows as $row => $value) {
         foreach ($value as $k => $v) {
             $val .= "{$v}\n";
         }
         $pdf->AddPdfLabel($val);
         $val = '';
     }
     $pdf->Output($fileName, 'D');
 }
コード例 #2
0
 /**
  * Get font names supported by the TCPDF package used to create PDF labels.
  *
  * @param string $name group name
  *
  * @return array   array of font names
  * @access public
  * @static
  */
 public static function getFontNames($name = 'label_format')
 {
     $label = new CRM_Utils_PDF_Label(self::getDefaultValues($name));
     return $label->getFontNames();
 }
コード例 #3
0
ファイル: Label.php プロジェクト: bhirsch/civicrm
 /**
  * function to create labels (pdf)
  *
  * @param   array    $contactRows   assciated array of contact data
  * @param   string   $format   format in which labels needs to be printed
  *
  * @return  null      
  * @access  public
  */
 function createLabel(&$contactRows, &$format)
 {
     require_once 'CRM/Utils/String.php';
     require_once 'CRM/Utils/PDF/Label.php';
     $pdf = new CRM_Utils_PDF_Label($format, 'mm');
     $pdf->Open();
     $pdf->AddPage();
     $pdf->AddFont('DejaVu Sans', '', 'DejaVuSans.php');
     $pdf->SetFont('DejaVu Sans');
     //build contact string that needs to be printed
     $val = null;
     foreach ($contactRows as $row => $value) {
         foreach ($value as $k => $v) {
             $val .= "{$v}\n";
         }
         $pdf->AddPdfLabel($val);
         $val = '';
     }
     $pdf->Output('MailingLabels_CiviCRM.pdf', 'D');
 }
コード例 #4
0
 /**
  * Get font names supported by the TCPDF package used to create PDF labels.
  *
  * @param void
  *
  * @return array   array of font names
  * @access public
  */
 function getFontNames()
 {
     $label = new CRM_Utils_PDF_Label(self::getDefaultValues());
     return $label->getFontNames();
 }