$ciudad_d = $rs->fields["DESTINO"]; $departamento_d = $rs->fields["DEPARTAMENTO"]; $peso = $rs->fields["PESO"]; $tarifa = $rs->fields["VALOR_PORTE"]; $valor_total = $rs->fields["VALOR_TOTAL"]; $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 define('FPDF_FONTPATH', 'font/'); require_once '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; we start at the second column //$pdf = new PDF_Label(array('name'=>'perso1', 'paper-size'=>'A4', 'marginLeft'=>1, 'marginTop'=>1, 'NX'=>2, 'NY'=>7, 'SpaceX'=>0, 'SpaceY'=>0, 'width'=>99.1, 'height'=>38.1, 'metric'=>'mm', 'font-size'=>14), 1, 2); // Standard format $pdf = new PDF_Label('L7163', 'mm', 1, 2); $pdf->Open(); $pdf->AddPage(); // Print labels for ($i = 1; $i <= 40; $i++) { $pdf->Add_PDF_Label(sprintf("%s\n%s\n%s\n%s, %s, %s", "Laurent {$i}", 'Immeuble Titi', 'av. fragonard', '06000', 'NICE', 'FRANCE')); } $pdf->Output(); ?>
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'); }
} if (trim($codePostal) != "") { $eti .= $codePostal . "\n"; } /* ------------------------------------ test d'impression --------------------- $eti = "M. Pierre Lavigne\nArchiviste\nPaleontographe\n"; $eti .= "Ecole Polytechnique de Montréal\nDAISG\nBureau des archives\n"; $eti .= "C.P. 6079\nsucc. Centre-ville\n"; $eti .= "Montréal (Québec)\nH3C 3A7"; ------------------------------------ fin test d'impression --------------------- */ if ($sgLj == 0 && strpos($eti, "Louise Jolicoeur")) { // rien imprimer } else { $pdf->Add_PDF_Label($eti); } } } $pdf->Output(); $pointcher = "étiquettes " . $instance_id; break; } // --- fin du switch $formeDe $application = "mem-" . $instance_id; $jour = date("Y-m-d"); $heure = date("H:i"); $totalTrouve = 1; $connexion = Connexion(USAGER, PASSE, BASE, SERVEUR); $requete = "INSERT INTO docs_stats " . " (docs_stats_id, no_unite, application, date, heure, " . " recherche, resultat, no_usager, adr_ip) " . " VALUES (0, '000', '{$application}', '{$jour}', '{$heure}', '{$pointcher}', '{$totalTrouve}', " . " '{$PHP_AUTH_USER}', '{$REMOTE_ADDR}')"; $resultat = ExecRequete($requete, $connexion);