コード例 #1
0
ファイル: ex.php プロジェクト: haus/CoMET
<?php

require 'PDF_Label.php';
/*------------------------------------------------
To create the object, 2 possibilities:
either pass a custom format via an array
or use a built-in AVERY name
------------------------------------------------*/
// Example of custom format
// $pdf = new PDF_Label(array('paper-size'=>'A4', 'metric'=>'mm', 'marginLeft'=>1, 'marginTop'=>1, 'NX'=>2, 'NY'=>7, 'SpaceX'=>0, 'SpaceY'=>0, 'width'=>99, 'height'=>38, 'font-size'=>14));
// Standard format
$pdf = new PDF_Label('L7163');
$pdf->AddPage();
// Print labels
for ($i = 1; $i <= 20; $i++) {
    $text = sprintf("%s\n%s\n%s\n%s %s, %s", "Laurent {$i}", 'Immeuble Toto', 'av. Fragonard', '06000', 'NICE', 'FRANCE');
    $pdf->Add_Label($text);
}
$pdf->Output();
?>
 
コード例 #2
0
ファイル: Certificates.php プロジェクト: sirromas/medical
 function create_label($courseid, $userid)
 {
     $user_address = $this->get_user_address_data($userid);
     $pdf = new PDF_Label('L7163');
     $pdf->AddPage();
     $text = sprintf("%s\n%s\n%s\n%s", "{$user_address->firstname} {$user_address->lastname}", "{$user_address->address}", "{$user_address->state}/" . $user_address->city . "", "{$user_address->zip}");
     $pdf->Add_Label($text);
     $dir_path = $this->cert_path . "/{$userid}";
     if (!is_dir($dir_path)) {
         if (!mkdir($dir_path)) {
             die('Could not write to disk');
         }
         // end if !mkdir($dir_path)
     }
     // end if !is_dir($dir_path)
     $path = $dir_path . "/label.pdf";
     $pdf->Output($path, 'F');
 }
コード例 #3
0
ファイル: Schedule.php プロジェクト: sirromas/medical
 function print_certificate_labels($courseid, $students)
 {
     $students_arr = explode(',', $students);
     if (count($students_arr) > 0) {
         $pdf = new PDF_Label('L7163');
         $pdf->AddPage();
         if (!is_dir($this->labels_path)) {
             if (!mkdir($dir_path)) {
                 die('Could not write to disk');
             }
             // end if !mkdir($dir_path)
         }
         // end if !is_dir($dir_path)
         foreach ($students_arr as $userid) {
             $user_address = $this->get_user_address_data($userid);
             $text = sprintf("%s\n%s\n%s %s %s", "{$user_address->firstname}  {$user_address->lastname}", "{$user_address->address}", "{$user_address->city} ,", "{$user_address->state}", "{$user_address->zip}");
             $pdf->Add_Label($text);
         }
         // end foreach
         $now = time();
         $path = $this->labels_path . "/" . $now . "_merged.pdf";
         $pdf->Output($path, 'F');
     }
     // end if count($students_arr)>0
     return $now . "_merged.pdf";
 }
コード例 #4
0
ファイル: Import.php プロジェクト: sirromas/medical
 function update_users_addresses()
 {
     $certificates = array();
     $query = "select * from mdl_certificates order by userid desc";
     $result = $this->db->query($query);
     while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
         $certificate = new stdClass();
         foreach ($row as $key => $value) {
             $certificate->{$key} = $value;
         }
         $certificates[] = $certificate;
     }
     $pdf2 = new PDF_Label('L7163');
     /*
      echo "<pre>";
      print_r($certificates);
      echo "</pre><br>";
     */
     $i = 0;
     echo "Total Certificates found: " . count($certificates);
     $pdf = new mPDF('utf-8', 'A4-P');
     foreach ($certificates as $certificate) {
         $user_address_block = $this->get_user_address_block($certificate->userid);
         echo "<br>-----------------------------------<br>";
         echo "User ID: " . $certificate->userid . "<br>";
         echo $user_address_block;
         $pdf2 = new PDF_Label('L7163');
         $pdf2->AddPage();
         $user_address = $this->get_user_address_data($certificate->userid);
         $text = sprintf("%s\n%s\n%s\n%s\n%s", "{$user_address->firstname} {$user_address->lastname}", "Phone: {$user_address->phone1}", "Email: {$user_address->email}", "{$user_address->address}", "{$user_address->city}, {$user_address->state}, {$user_address->zip}");
         //$text = sprintf("%s\n%s\n%s\n%s", $user_address_block);
         $pdf2->Add_Label($text);
         $dir_path = $this->cert_path . "/{$certificate->userid}";
         if (!is_dir($dir_path)) {
             if (!mkdir($dir_path)) {
                 die('Could not write to disk');
             }
             // end if !mkdir($dir_path)
         }
         // end if !is_dir($dir_path)
         $path = $dir_path . "/label.pdf";
         $pdf2->Output($path, 'F');
         $i++;
         /*
         * 
          $pdf->WriteHTML($user_address_block);
          $dir_path = $this->cert_path . "/$certificate->userid";
          if (!is_dir($dir_path)) {
          if (!mkdir($dir_path)) {
          die('Could not write to disk');
          } // end if !mkdir($dir_path)
          } // end if !is_dir($dir_path)
          $path = $dir_path . "/label.pdf";
          echo "Label location: ".$path."<br>";
          $pdf->Output($path, 'F');
          $pdf->Close();
          echo "<br>Address label for User ($certificate->userid) was created";
          echo "<br>-----------------------------------<br>";
          $i++;
          } // end foreach
         * 
         */
     }
     // end foreach
     echo "<br>Total Labels created: " . $i . "<br>";
 }