コード例 #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
            $filename .= "_Avery5160";
        }
        $filename .= ".pdf";
        //$rank = str_replace(",",", ",$row_brewer['brewerJudgeRank']);
        $bjcp_rank = explode(",", $row_brewer['brewerJudgeRank']);
        $rank = bjcp_rank($bjcp_rank[0], 2);
        if (!empty($bjcp_rank[1])) {
            $rank .= ", " . $bjcp_rank[1];
        }
        if (!empty($bjcp_rank[2])) {
            $rank .= ", " . $bjcp_rank[2];
        }
        //$rank2 = truncate($rank2,50);
        $j = preg_replace('/[a-zA-Z]/', '', $row_brewer['brewerJudgeID']);
        //$j = ltrim($row_brewer['brewerJudgeID'],'/[a-z][A-Z]/');
        if ($j > 0) {
            $judge_id = " (" . $row_brewer['brewerJudgeID'] . ")";
        } else {
            $judge_id = "";
        }
        for ($i = 0; $i < $number_of_labels; $i++) {
            $text = sprintf("\n%s %s\n%s %s\n%s", $first_name, $last_name, truncate($rank, 50), strtoupper($judge_id), strtolower($row_brewer['brewerEmail']));
            $text = iconv('UTF-8', 'windows-1252', $text);
            $pdf->Add_Label($text);
        }
        ob_end_clean();
        $pdf->Output($filename, 'D');
    }
} else {
    echo "<p>Not available.</p>";
}
コード例 #3
0
ファイル: listado_guias.php プロジェクト: johnfelipe/orfeo
    $sec = str_pad($sec, 5, "0", STR_PAD_LEFT);
    $campo1 = $rs->fields["DESTINO"];
    $linea0 = "                    {$radicado_sal}";
    $linea1 = "{$fecha_adm}                  {$oficina_org}";
    $linea2 = "{$nombre_r}";
    $linea3 = "{$direccion_r}";
    $linea4 = str_pad($nombre_d, 60, " ", STR_PAD_RIGHT) . $telefono_d;
    $linea5 = str_pad($direccion_d, 48, " ", STR_PAD_RIGHT) . str_pad($ciudad_d, 16, " ", STR_PAD_RIGHT) . $departamento_d;
    $linea6 = str_pad("", 45, " ", STR_PAD_RIGHT) . str_pad($peso, 13, " ", STR_PAD_LEFT) . str_pad($tarifa, 10, " ", STR_PAD_LEFT);
    $linea8 = str_pad("", 60, " ", STR_PAD_RIGHT) . str_pad($valor_total, 8, " ", STR_PAD_LEFT);
    $pdf->Add_PDF_Label(sprintf("%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s", $linea0, $linea1, $linea2, $linea3, $linea4, $linea5, $linea6, $linea8));
    $rs->MoveNext();
}
$fecha = date("Ymd");
$archivo_labels = "../bodega/pdfs/guias/guia1{$fecha}.pdf";
$pdf->Output($archivo_labels);
?>
		<TABLE BORDER=0 WIDTH=100% class="titulos2">
		<TR><TD class="listado2" align="center">
			<center><b>Se han Generado <?php 
echo $i;
?>
 Guias para Imprimir. <br> 
			<a href='<?php 
echo $archivo_labels;
?>
?<?php 
echo date("dmYh") . time("his");
?>
' target='<?php 
echo date("dmYh") . time("his");
コード例 #4
0
ファイル: Labels.inc.php プロジェクト: radicaldesigns/amp
 function list2labels($doc_name = 'labels.pdf', $label_type = '5160', $include_title = false, $include_company = false)
 {
     $labels = new PDF_Label($label_type);
     $labels->Open();
     $entry_count = 0;
     $dataset = $udm->getData();
     foreach ($dataset as $currentrow) {
         $new_entry = '';
         $new_entry = $currentrow['Name'] . "\n";
         if ($currentrow['occupation'] > '' && $include_title) {
             $new_entry .= $currentrow['occupation'] . "\n";
         }
         if ($currentrow['Company'] > '' && $include_company) {
             $new_entry .= $currentrow['Company'] . "\n";
         }
         $new_entry .= $currentrow['Street'] . "\n";
         if ($currentrow['Street_2'] > '') {
             $new_entry .= $currentrow['Street_2'] . "\n";
         }
         if ($currentrow['Street_2'] > '') {
             $new_entry .= $currentrow['Street_3'] . "\n";
         }
         $new_entry .= $currentrow['City'] . ", ";
         $new_entry .= $currentrow['State'] . "  ";
         $new_entry .= $currentrow['Zip'];
         if ($currentrow['Country'] > '' && $currentrow['Country'] != "USA" && $currentrow['Country'] != "U.S.A." && substr($currentrow['Country'], 0, 13) != "United States") {
             $new_entry .= "\n" . $currentrow['Country'];
         }
         if ($currentrow['Street'] != '' && $currentrow['Zip'] != '') {
             $entry_count++;
             $myzip = $labels->ParseZipCode($currentrow['Zip']);
             if ($myzip != "") {
                 $validzips++;
             }
             $labels->Add_PDF_Label($new_entry, $myzip);
         }
     }
     $new_entry = $validzips . " labels printed with bar codes\n{$entry_count} total labels printed";
     $labels->Add_PDF_Label($new_entry);
     $labels->Output($doc_name, 'I');
 }
コード例 #5
0
            $headertext = '';
            $labeltext = '';
        }
        $pdf->Add_Label($headertext, $labeltext, $padding, $border, $image, $imagewidth, $imageheight, $headerfontsize, $fontsize, $idfontsize, $barcode, $nbw, $bh, $barcodesize, $wantraligntext);
        // for code39 barcodes: check if barcode fits inside label, allowing space for its quiet zone
        //2 narrow spacings if nbw>0.29, + 1 char checksum +2 chars start/stop (*) +10 bars quiet zone on each side
        /*
            if ($barcodewidth>=$lwidth) {
              $pdf->Ln();
              $pdf->Cell(0,20,"Required barcode width ($barcodewidth mm) too wide for label width ($lwidth mm)",1,1,'C');
              break;
        
            }
        */
    }
    if ($row == $rows) {
        $row = 0;
        $col = 0;
        $pages++;
        //$pdf->AddPage('P','A4');
    }
}
$dstr = date('Y-m-d_his');
$pdf->Output("labels-{$dstr}.pdf", 'D');
?>



</body>
</html>
コード例 #6
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";
 }
コード例 #7
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');
 }
コード例 #8
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>";
 }