本文整理汇总了PHP中Cezpdf::ezTable方法的典型用法代码示例。如果您正苦于以下问题:PHP Cezpdf::ezTable方法的具体用法?PHP Cezpdf::ezTable怎么用?PHP Cezpdf::ezTable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cezpdf
的用法示例。
在下文中一共展示了Cezpdf::ezTable方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save_table
public function save_table($options)
{
if (!$this->table_header) {
foreach (array_keys($this->table_rows[0]) as $k) {
$this->table_header[$k] = '';
}
}
$this->pdf->ezTable($this->table_rows, $this->table_header, '', $options);
}
示例2: tabla
/**
* Genera una tabla para impresion en pdf
*
* @param array $datos arreglo asociativo el cual contiene:
* 'datos_tabla' => arreglo estilo recordset, donde cada elemento del mismo es un arreglo asociativo 'nombre_columna' => 'valor'
* 'titulo_tabla' => texto con el titulo de la tabla
* 'titulos_columnas' => arreglo asociativo 'nombre_columna' => 'descripcion_columna'
* @param boolean $ver_titulos_col indica si se imprimiran los titulos de las columnas, por defecto no
* @param integer $tamanio tamaño de la letra de la tabla
* @param array $opciones arreglo asociativo con estilos de la tabla
*/
function tabla($datos, $ver_titulos_col = false, $tamanio = 8, $opciones = array())
{
$ver_tit_col = $ver_titulos_col ? 1 : 0;
$texto_tit_col = isset($datos['titulos_columnas']) ? $datos['titulos_columnas'] : '';
$texto_titulo_tabla = isset($datos['titulo_tabla']) ? $datos['titulo_tabla'] : '';
$opciones_def = array('splitRows' => 0, 'rowGap' => 1, 'showHeadings' => $ver_tit_col, 'titleFontSize' => 9, 'fontSize' => $tamanio, 'shadeCol' => array(0.9, 0.9, 0.9), 'outerLineThickness' => 0.7, 'innerLineThickness' => 0.7, 'xOrientation' => 'center', 'maxWidth' => $this->get_ancho(100));
$opciones = array_merge($opciones_def, $opciones);
$this->pdf->ezTable($datos['datos_tabla'], $texto_tit_col, $texto_titulo_tabla, $opciones);
}
示例3: Cezpdf
function generar_pdf()
{
require_once toba_dir() . '/php/3ros/ezpdf/class.ezpdf.php';
$pdf = new Cezpdf();
$pdf->selectFont(toba_dir() . '/php/3ros/ezpdf/fonts/Helvetica.afm');
$pdf->ezText('Ejemplo Firma Digital. Tiene dos attachments XML', 14);
//-- Cuadro con datos
$opciones = array('splitRows' => 0, 'rowGap' => 1, 'showHeadings' => true, 'titleFontSize' => 9, 'fontSize' => 10, 'shadeCol' => array(0.9, 0.9, 0.9), 'outerLineThickness' => 0.7, 'innerLineThickness' => 0.7, 'xOrientation' => 'center', 'width' => 500);
$this->s__datos_juegos = toba::db()->consultar("SELECT * from ref_juegos");
$pdf->ezTable($this->s__datos_juegos, '', 'Juegos', $opciones);
$this->s__datos_deportes = toba::db()->consultar("SELECT * from ref_deportes");
$pdf->ezTable($this->s__datos_deportes, '', 'Deportes', $opciones);
$tmp = $pdf->ezOutput(0);
$this->s__pdf = array();
$sesion = get_firmador()->generar_sesion();
$this->s__pdf['path'] = toba::proyecto()->get_path_temp() . "/doc{$sesion}_sinfirma.pdf";
if (!file_put_contents($this->s__pdf['path'], $tmp)) {
throw new toba_error("Imposible escribir en '{$this->s__pdf['path']}'. Chequee permisos");
}
}
示例4: bukti
public function bukti($a)
{
$pdfku = new Cezpdf("A5", 'landscape');
//595.28,841.29
$pdfku->addInfo('Title', 'List Barang');
$pdfku->ezSetCmMargins("3", "3", "3", "3");
$barang = $this->barang->detail_peminjaman($a);
$pdfku->ezSetY(100);
$pdfku->ezSetDy(230);
//$pdfku->addJpegFromFile("icon.jpg",20,300,-1);
$pdfku->addText(120, $pdfku->y + 30, 18, "Bukti Peminjaman Inventaris Laboratorium");
$pdfku->addText(160, $pdfku->y + 10, 15, "Komputasi Berbasis Jaringan (KBJ)");
$cols_db = array('id_barang' => 'ID Barang', 'nama_barang' => 'Nama Barang');
$option_db = array('showHeadings' => 2, 'shaded' => 0, 'xPos' => 'center', 'xOrientation' => 'center', 'fontSize' => 12, 'cols' => array('id_barang' => array('justification' => 'center', 'width' => '120'), 'nama_barang' => array('justification' => 'center', 'width' => '120')));
$pdfku->ezTable($barang, $cols_db, '', $option_db);
$pdfku->addText(100, $pdfku->y - 40, 12, "Mengetahui ");
$pdfku->addText(90, $pdfku->y - 60, 12, "Administrator Lab");
$pdfku->addText(400, $pdfku->y - 60, 12, "Kepala Laboratorium");
$pdfku->addText(80, $pdfku->y - 130, 10, "__________________");
$pdfku->addText(400, $pdfku->y - 130, 10, "__________________");
$pdfku->ezStream();
}
示例5: trim
$pdf->ezSetCmMargins(1.5, 1, 2, 3);
$pdf->addJpegFromFile("../img/o.jpg", 50, 750, 100);
$folio = trim($_GET['folio']);
$result = mysql_query("select folio,fecha,c.nombre_contacto,total,\n\tconcat(nombre,' ',e.apellido_paterno,' ',e.apellido_materno) as nombre \n\tfrom ventas v inner join clientes c on c.matricula = v.cliente \n\tinner join empleados e on e.matricula = v.empleado \n\twhere v.status = 'PAGADA' and folio = '" . $folio . "' ");
while ($datatmp = mysql_fetch_array($result)) {
$datos = $datatmp['nombre_contacto'];
$total = $datatmp['total'];
$emp = $datatmp['nombre'];
$data[] = array_merge($datatmp, array('folio'));
}
$options = array('shadeHeadingCol' => array(0.6, 0.6, 0.5), 'shadeCol' => array(0.9, 0.9, 0.9), 'xOrientation' => 'right', 'width' => 70, 'fontSize' => 8, 'xPos' => 480);
$titlef = array('folio' => '<b>Folio</b>');
$titles = array('fecha' => '<b>Fecha</b>');
$titlet = array('total' => '<b>Total</b>');
$pdf->ezText("\n", 10);
$pdf->ezTable($data, $titlef, '', $options);
$pdf->ezText("\n", 10);
$pdf->ezTable($data, $titles, '', $options);
$pdf->ezText("\n", 10);
$pdf->addText(50, 700, 12, "<b>Atendio: </b>\n");
$pdf->addText(100, 700, 12, $emp);
$pdf->addText(50, 680, 12, "<b>Cliente: </b>\n");
$pdf->addText(100, 680, 12, $datos);
//RECUPERANDO DETALLE DE VENTA
$sql = mysql_query("select dv.cantidad,p.nombre,dv.precio,dv.subtotal \n \t\tfrom detalle_venta dv\n \t\tinner join platillos p on p.id_platillo = dv.clave_producto \n \t\twhere folio = '" . $folio . "' ");
while ($row = mysql_fetch_array($sql)) {
$dat[] = array_merge($row);
}
$optionsdv = array('shadeHeadingCol' => array(0.6, 0.6, 0.5), 'shadeCol' => array(0.9, 0.9, 0.9), 'xOrientation' => 'center', 'width' => 500, 'fontSize' => 10, 'xPos' => 'center', 'cols' => array('cantidad' => array('justification' => 'center'), 'nombre' => array('justification' => 'center'), 'precio' => array('justification' => 'center'), 'subtotal' => array('justification' => 'center')));
$titledv = array('cantidad' => '<b>Cantidad</b>', 'nombre' => '<b>Descripción</b>', 'precio' => '<b>Precio</b>', 'subtotal' => '<b>SubTotal</b>');
$pdf->ezTable($dat, $titledv, '', $optionsdv);
示例6: Cezpdf
if (@$_REQUEST['action'] == "getpdf") {
mysql_connect("localhost", "root", "");
mysql_select_db("cdcol");
include 'Cezpdf.php';
$pdf = new Cezpdf();
$pdf->selectFont('/Applications/XAMPP/xamppfiles/lib/php/fonts/Helvetica.afm');
$pdf->ezText('CD Collection', 14);
$pdf->ezText('Copyright 2002-2013 Kai Seidler, oswald@apachefriends.org, GPL', 10);
$pdf->ezText('', 12);
$result = mysql_query("SELECT id,titel,interpret,jahr FROM cds ORDER BY interpret;");
$i = 0;
while ($row = mysql_fetch_array($result)) {
$data[$i] = array('interpret' => $row['interpret'], 'titel' => $row['titel'], 'jahr' => $row['jahr']);
$i++;
}
$pdf->ezTable($data, "", "", array('width' => 500));
$pdf->ezStream();
exit;
}
include "langsettings.php";
?>
<html>
<head>
<title>apachefriends.org cd collection</title>
<link href="xampp.css" rel="stylesheet" type="text/css">
</head>
<body>
<p>
<h1><?php
示例7: foreach
$pdf->selectFont($font_dir . '/Helvetica.afm');
$pdf->ezText(w2PgetConfig('company_name'), 12);
if ($log_all) {
$date = new w2p_Utilities_Date();
$pdf->ezText("\nAll hours as of " . $date->format($df), 8);
} else {
$sdate = new w2p_Utilities_Date($log_start_date);
$edate = new w2p_Utilities_Date($log_end_date);
$pdf->ezText("\nHours from " . $sdate->format($df) . ' to ' . $edate->format($df), 8);
}
$pdf->selectFont($font_dir . '/Helvetica-Bold.afm');
$pdf->ezText("\n" . $AppUI->_('Overall Report'), 12);
foreach ($allpdfdata as $company => $data) {
$title = $company;
$options = array('showLines' => 1, 'showHeadings' => 0, 'fontSize' => 8, 'rowGap' => 2, 'colGap' => 5, 'xPos' => 50, 'xOrientation' => 'right', 'width' => '500', 'cols' => array(0 => array('justification' => 'left', 'width' => 250), 1 => array('justification' => 'right', 'width' => 120)));
$pdf->ezTable($data, null, $title, $options);
}
$w2pReport = new CReport();
if ($fp = fopen($temp_dir . '/' . $w2pReport->getFilename() . '.pdf', 'wb')) {
fwrite($fp, $pdf->ezOutput());
fclose($fp);
echo '<a href="' . W2P_BASE_URL . '/files/temp/' . $w2pReport->getFilename() . '.pdf" target="pdf">';
echo $AppUI->_('View PDF File');
echo '</a>';
} else {
echo 'Could not open file to save PDF. ';
if (!is_writable($temp_dir)) {
'The files/temp directory is not writable. Check your file system permissions.';
}
}
}
示例8: array
$data = array_merge($data, array(array('RESULTADO' => "NO SE ESPECIFICÓ EL GRUPO A RECUPERAR")));
}
$retirados = "";
$orientIzq = array("left" => 0);
$justCentro = array("justification" => "center");
$estilo1 = array("justification" => "left", "leading" => 8);
$estilo2 = array("left" => 0, "leading" => 12);
$estilo3 = array("left" => 0, "leading" => 15);
$pdf = new Cezpdf("LETTER", "landscape");
$pdf->selectFont("{$ruta_raiz}/include/pdf/fonts/Times-Roman.afm");
$pdf->ezText("RECUPERACION DE LISTADO \n\n", 15, $justCentro);
$pdf->ezText("Dependencia: {$dependencia} \n", 12, $estilo1);
$pdf->ezText("Usuario Responsable: " . $objUsuario->get_usua_nomb() . " \n", 12, $estilo1);
$pdf->ezText("Fecha: {$fechaRadGrupo} \n", 12, $estilo1);
$pdf->ezText("\n\n\n ", 6, $estilo1);
$pdf->ezTable($data, '', '', array('fontSize' => 6, 'width' => 700));
//Var para almacenar la hora con formato
$hora = date("H") . "_" . date("i") . "_" . date("s");
// var que almacena el dia de la fecha
$ddate = date('d');
// var que almacena el mes de la fecha
$mdate = date('m');
// var que almacena el año de la fecha
$adate = date('Y');
// var que almacena la fecha formateada
$fecha = $adate . "_" . $mdate . "_" . $ddate;
//guarda el path del archivo generado
$archivo = "{$ruta_raiz}/bodega/masiva/tmp_{$usua_doc}" . "_{$fecha}" . "_{$hora}.pdf";
//Referencia el PDF a generar
$pdfcode = $pdf->ezOutput();
$fp = fopen($archivo, 'wb');
示例9: pdfObservations
public function pdfObservations($result)
{
global $loggedUser, $dateformat, $instDir, $objObservation, $objObserver, $objInstrument, $objLocation, $objPresentations, $objObject, $objFilter, $objEyepiece, $objLens;
$result = $this->sortResult($result);
$pdf = new Cezpdf('a4', 'portrait');
$pdf->ezStartPageNumbers(300, 30, 10);
$pdf->selectFont($instDir . 'lib/fonts/Helvetica.afm');
$pdf->ezText(utf8_decode(html_entity_decode($_GET['pdfTitle'])) . "\n");
$i = 0;
while (list($key, $value) = each($result)) {
if ($i++ > 0) {
$pdf->ezNewPage();
}
$obs = $objObservation->getAllInfoDsObservation($value['observationid']);
$object = $objObject->getAllInfoDsObject($obs['objectname']);
if ($loggedUser && $objObserver->getObserverProperty($loggedUser, 'UT')) {
$date = sscanf($obs["date"], "%4d%2d%2d");
} else {
$date = sscanf($obs["localdate"], "%4d%2d%2d");
}
if ($obs['seeing'] > -1) {
$seeing = true;
} else {
$seeing = false;
}
$formattedDate = date($dateformat, mktime(0, 0, 0, $date[1], $date[2], $date[0]));
$temp = array("Name" => html_entity_decode(LangPDFMessage1) . " : " . $obs['objectname'], "altname" => html_entity_decode(LangPDFMessage2) . " : " . $object["altname"], "type" => $GLOBALS[$object['type']] . html_entity_decode(LangPDFMessage12) . $GLOBALS[$object['con']], "visibility" => $obs['visibility'] ? html_entity_decode(LangViewObservationField22) . " : " . $GLOBALS['Visibility' . $obs['visibility']] : '', "seeing" => $seeing ? LangViewObservationField6 . " : " . $GLOBALS['Seeing' . $obs['seeing']] : '', "limmag" => $obs['limmag'] ? LangViewObservationField7 . " : " . $obs['limmag'] : '', "filter" => $obs['filterid'] ? LangViewObservationField31 . " : " . $objFilter->getFilterPropertyFromId($obs['filterid'], 'name') : '', "eyepiece" => $obs['eyepieceid'] ? LangViewObservationField30 . " : " . $objEyepiece->getEyepiecePropertyFromId($obs['eyepieceid'], 'name') : '', "lens" => $obs['lensid'] ? LangViewObservationField32 . " : " . $objLens->getLensPropertyFromId($obs['lensid'], 'name') : '', "observer" => html_entity_decode(LangPDFMessage13) . $objObserver->getObserverProperty($obs['observerid'], 'firstname') . " " . $objObserver->getObserverProperty($obs['observerid'], 'name') . html_entity_decode(LangPDFMessage14) . $formattedDate, "instrument" => html_entity_decode(LangPDFMessage11) . " : " . $objInstrument->getInstrumentPropertyFromId($obs['instrumentid'], 'name'), "location" => html_entity_decode(LangPDFMessage10) . " : " . $objLocation->getLocationPropertyFromId($obs['locationid'], 'name'), "description" => $objPresentations->br2nl(html_entity_decode($obs['description'])), "desc" => html_entity_decode(LangPDFMessage15));
$obs1[] = $temp;
$nm = $obs['objectname'];
if ($object["altname"]) {
$nm = $nm . " (" . $object["altname"] . ")";
}
$pdf->ezText($nm, "14");
$tmp = array(array("type" => $temp["type"]));
$pdf->ezTable($tmp, array("type" => utf8_decode(html_entity_decode(LangPDFMessage5))), "", array("width" => "500", "showHeadings" => "0", "showLines" => "0", "shaded" => "0"));
$tmp = array(array("location" => $temp["location"], "instrument" => $temp["instrument"]));
$pdf->ezTable($tmp, array("location" => utf8_decode(html_entity_decode(LangPDFMessage1)), "instrument" => utf8_decode(html_entity_decode(LangPDFMessage2))), "", array("width" => "500", "showHeadings" => "0", "showLines" => "0", "shaded" => "0"));
$tmp = array(array("eyepiece" => $temp["eyepiece"]));
if ($obs['eyepieceid']) {
$pdf->ezTable($tmp, array("eyepiece" => "test"), "", array("width" => "500", "showHeadings" => "0", "showLines" => "0", "shaded" => "0"));
}
$tmp = array(array("filter" => $temp["filter"]));
if ($obs['filterid']) {
$pdf->ezTable($tmp, array("filter" => "test"), "", array("width" => "500", "showHeadings" => "0", "showLines" => "0", "shaded" => "0"));
}
$tmp = array(array("lens" => $temp["lens"]));
if ($obs['lensid']) {
$pdf->ezTable($tmp, array("lens" => "test"), "", array("width" => "500", "showHeadings" => "0", "showLines" => "0", "shaded" => "0"));
}
$tmp = array(array("seeing" => $temp["seeing"]));
if ($seeing) {
$pdf->ezTable($tmp, array("seeing" => "test"), "", array("width" => "500", "showHeadings" => "0", "showLines" => "0", "shaded" => "0"));
}
$tmp = array(array("limmag" => $temp["limmag"]));
if ($obs['limmag']) {
$pdf->ezTable($tmp, array("limmag" => "test"), "", array("width" => "500", "showHeadings" => "0", "showLines" => "0", "shaded" => "0"));
}
$tmp = array(array("visibility" => $temp["visibility"]));
if ($obs['visibility']) {
$pdf->ezTable($tmp, array("visibility" => "test"), "", array("width" => "500", "showHeadings" => "0", "showLines" => "0", "shaded" => "0"));
}
$tmp = array(array("observer" => $temp["observer"]));
$pdf->ezTable($tmp, array("observer" => utf8_decode(html_entity_decode(LangPDFMessage1))), "", array("width" => "500", "showHeadings" => "0", "showLines" => "0", "shaded" => "0"));
$pdf->ezText(utf8_decode(LangPDFMessage15), "12");
$pdf->ezText("");
$tmp = array(array("description" => $temp["description"]));
$pdf->ezTable($tmp, array("description" => utf8_decode(html_entity_decode(LangPDFMessage1))), "", array("width" => "500", "showHeadings" => "0", "showLines" => "0", "shaded" => "0"));
if ($objObservation->getDsObservationProperty($value['observationid'], 'hasDrawing')) {
$pdf->ezText("");
$pdf->ezImage($instDir . "deepsky/drawings/" . $value['observationid'] . ".jpg", 0, 500, "none", "left");
}
$pdf->ezText("");
}
$pdf->ezStream();
}
示例10: sum
$pdf->closeObject();
// Tampilkan object di semua halaman
$pdf->addObject($all, 'all');
// Baca input tanggal yang dikirimkan user
$mulai = $_GET[tgl1];
$selesai = $_GET[tgl2];
// Koneksi ke database dan tampilkan datanya
// Query untuk merelasikan kedua tabel di filter berdasarkan tanggal
$sql = mysql_query("select kd_penj.tanggal,kd_penj.kd_pjl,penjualan.id_product,barang.nama,\n penjualan.harga,penjualan.jumlah,penjualan.subtotal\n from penjualan,kd_penj,barang\n where kd_penj.kd_pjl=penjualan.id_transaksi and barang.kode=penjualan.id_product and kd_penj.tanggal\n\t\t\t\t\t\t\t\t\t\t between '{$mulai}' and '{$selesai}'\n\t\t\t\t\t");
$sum = mysql_fetch_array(mysql_query("SELECT sum(total) as total from \n\t\tkd_penj where tanggal between '{$mulai}' and '{$selesai}'"));
$jml = mysql_num_rows($sql);
if ($jml > 0) {
$i = 1;
while ($r = mysql_fetch_array($sql)) {
$hargarp = rp($r[4]);
$subrp = rp($r[6]);
$data[$i] = array('<b>No</b>' => $i, '<b>Tanggal</b>' => $r[0], '<b>Kode Transaksi</b>' => $r[1], '<b>Nama Barang</b>' => $r[3], '<b>Harga</b>' => $hargarp, '<b>Jumlah</b>' => $r[5], '<b>SubTotal</b>' => $subrp);
$i++;
}
$pdf->ezTable($data, '', '', '');
$tot = rp($sum[total]);
$pdf->ezText("\n\nTotal keseluruhan : Rp. {$tot}");
$pdf->ezText("Pencarian dari Tanggal {$mulai} s/d {$selesai}");
// Penomoran halaman
$pdf->ezStartPageNumbers(320, 15, 8);
$pdf->ezStream();
} else {
$m = $_POST[tgl_1] . '-' . $_POST[bln_1] . '-' . $_POST[thn_1];
$s = $_POST[tgl_2] . '-' . $_POST[bln_2] . '-' . $_POST[thn_2];
echo "<script>window.alert('Tidak ada laporan Penjualan pada Tanggal {$m} s/d {$s}');\n window.location=('" . $uri . "/apotek/out.php')</script>";
}
示例11: Cezpdf
}
$round = $_SESSION["round" . $dist];
if ($aryCompo = $db->getCompetition($id)) {
// $rsHeats = mysql_query("select * from tblRace where competitionId = '$id' and distance = '$dist' and type = '$round' order by number");
$pdf = new Cezpdf();
$pdf->selectFont('./fonts/Helvetica');
$roundname = _('Stafet');
$pdf->ezSetY(830);
$pdf->ezText($aryCompo['name'] . " - " . date('d-m-Y', strtotime($aryCompo['date'])), 18, array('justification' => 'center'));
$pdf->ezText($roundname . ' ' . gettext_dist($dist), 16, array('justification' => 'center'));
$pdf->ezText('', 16, array('justification' => 'center'));
$rsSwimmers = $db->teamList($id, $dist);
$aryData = array();
$lane = 1;
$startTime = 0;
while ($arySwimmers = $db->fetch_array($rsSwimmers)) {
if ($startTime == 0) {
$startTime = $arySwimmers['time'];
}
$aryData[] = array('Bane' => $lane, 'Klub' => $arySwimmers['cname'], 'Starttal' => round($startTime - $arySwimmers['time']));
$teamSwimmers = $db->teamSwimmers($arySwimmers['id']);
while ($swimmer = $db->fetch_array($teamSwimmers)) {
$aryData[] = array('Bane' => '', 'Klub' => '- ' . $swimmer['name'], 'Starttal' => '');
}
$lane++;
}
$pdf->ezTable($aryData, array('Bane' => _('Bane'), 'Klub' => _('Hold'), 'Starttal' => _('Starttal')), '', array('xPos' => 57, 'xOrientation' => 'right', 'width' => 481, 'fontSize' => 16, 'titleFontSize' => 18, 'cols' => array('Bane' => array('width' => 54, 'justification' => 'center'), 'Starttal' => array('justification' => 'right', 'width' => 68))));
header("Content-type: application/pdf");
$pdf->ezStream();
}
$db->close();
示例12: imprimeAlumnosXcursada
static function imprimeAlumnosXcursada($anio, $carrera)
{
/*
* q hace: genera un array ezTable() con todos los alumnos de una cursada y carrera
* previamente seleccionado.
* q devuelve: un objeto Cezpdf conteniendo un ezTable() que debe ser abierta por el controlador correspondiente
* para generar un pdf en el navegador
*
*/
$pdf = new Cezpdf('a4', 'landscape');
$pdf->selectFont('../librerias/ezPDF/fonts/Helvetica.afm');
$dato = Alumno::alumnosXcursada($anio, $carrera);
$pdf->ezTable($dato);
//$pdf->ezStream(); esta linea va en el controlador alumno.php en el 'case print:'
return $pdf;
}
示例13: showFooter
/**
* Print generic footer
*
* @param $type display type (0=HTML, 1=Sylk,2=PDF,3=CSV)
* @param $title title of file : used for PDF (default '')
*
* @return string to display
**/
static function showFooter($type, $title = "")
{
$out = "";
switch ($type) {
case self::PDF_OUTPUT_LANDSCAPE:
//pdf
global $PDF_HEADER, $PDF_ARRAY;
$pdf = new Cezpdf('a4', 'landscape');
$pdf->selectFont(GLPI_ROOT . "/lib/ezpdf/fonts/Helvetica.afm");
$nb = count($PDF_ARRAY);
$tmptxt = sprintf(_n('%s item', '%s items', $nb), $nb);
$pdf->ezStartPageNumbers(750, 10, 10, 'left', "GLPI PDF export - " . Html::convDate(date("Y-m-d")) . " - " . Toolbox::decodeFromUtf8($tmptxt, 'windows-1252') . " - {PAGENUM}/{TOTALPAGENUM}");
$options = array('fontSize' => 8, 'colGap' => 2, 'maxWidth' => 800, 'titleFontSize' => 8);
$pdf->ezTable($PDF_ARRAY, $PDF_HEADER, Toolbox::decodeFromUtf8($title, 'windows-1252'), $options);
$pdf->ezStream();
break;
case self::PDF_OUTPUT_PORTRAIT:
//pdf
global $PDF_HEADER, $PDF_ARRAY;
$pdf = new Cezpdf('a4', 'portrait');
$pdf->selectFont(GLPI_ROOT . "/lib/ezpdf/fonts/Helvetica.afm");
$nb = count($PDF_ARRAY);
$tmptxt = sprintf(_n('%s item', '%s items', $nb), $nb);
$pdf->ezStartPageNumbers(550, 10, 10, 'left', "GLPI PDF export - " . Html::convDate(date("Y-m-d")) . " - " . Toolbox::decodeFromUtf8($tmptxt, 'windows-1252') . " - {PAGENUM}/{TOTALPAGENUM}");
$options = array('fontSize' => 8, 'colGap' => 2, 'maxWidth' => 565, 'titleFontSize' => 8);
$pdf->ezTable($PDF_ARRAY, $PDF_HEADER, Toolbox::decodeFromUtf8($title, 'windows-1252'), $options);
$pdf->ezStream();
break;
case self::SYLK_OUTPUT:
//sylk
global $SYLK_HEADER, $SYLK_ARRAY, $SYLK_SIZE;
// largeurs des colonnes
foreach ($SYLK_SIZE as $num => $val) {
$out .= "F;W" . $num . " " . $num . " " . min(50, $val) . "\n";
}
$out .= "\n";
// Header
foreach ($SYLK_HEADER as $num => $val) {
$out .= "F;SDM4;FG0C;" . ($num == 1 ? "Y1;" : "") . "X{$num}\n";
$out .= "C;N;K\"" . self::sylk_clean($val) . "\"\n";
$out .= "\n";
}
// Datas
foreach ($SYLK_ARRAY as $row => $tab) {
foreach ($tab as $num => $val) {
$out .= "F;P3;FG0L;" . ($num == 1 ? "Y" . $row . ";" : "") . "X{$num}\n";
$out .= "C;N;K\"" . self::sylk_clean($val) . "\"\n";
}
}
$out .= "E\n";
break;
case self::CSV_OUTPUT:
//csv
break;
default:
$out = "</table></div>\n";
}
return $out;
}
示例14: array
$pdf->addPngFromFile($pathvars["fileroot"] . "/images/net/kleines-wappen.png", 30, 780, 46);
$pdf->addPngFromFile($pathvars["fileroot"] . "/images/net/auge.png", 300, 780, 70);
// eine linie
$pdf->line(20, 770, 560, 770);
$pdf->addText(120, 790, '20', '<b>Vermessungsamt</b>');
$pdf->addText(380, 790, '20', '<i>Friedberg</i>');
// seiten nummern
$pdf->ezStartPageNumbers(300, 20, 12, '', '', 1);
// hier geht es los
$pdf->ezSetDy(-60);
// spaltenweise ausgabe an
$pdf->ezColumnsStart(array("num" => 2, "gap" => 20));
// wichtig: damit der die ausgabe am spaltenbeginn steht
#$pdf->ezSetDy(10);
// Textblock
#$pdf->ezText($text,10,array( "justification" => "full" )); // "leading"=>20, "spacing"=>1
// Tabellen
$data = array(array('num' => 1, 'name' => 'gandalf', 'type' => 'wizard'), array('num' => 2, 'name' => 'bilbo', 'type' => 'hobbit', 'url' => 'http://www.ros.co. nz/pdf/'), array('num' => 3, 'name' => 'frodo', 'type' => 'hobbit'), array('num' => 4, 'name' => 'saruman', 'type' => 'bad dude', 'url' => 'http://sourceforge.net/projects/pdf-php'), array('num' => 5, 'name' => 'sauron', 'type' => 'really bad dude'));
for ($i = 0; $i <= 20; $i++) {
$pdf->ezTable($data, '', '', array("fontSize" => 9, "width" => 260));
}
// umbruch
$pdf->ezSetDy(-10);
// Textblock
#$pdf->ezText($text,10,array( "justification" => "full" )); // "leading"=>20, "spacing"=>1
// spaltenweise ausgabe aus
$pdf->ezColumnsStop();
// ausgabe
$pdf->ezStream();
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
示例15: array
/**
* Creates a PDF document and sends this pricelist to the client
*
* Unfortunately, ezpdf does not return anything after printing the
* document, so there's no way to tell whether it has succeeded.
* Thus, you should not rely on the return value, except when it is
* false -- in that case, loading of some data failed.
* @return boolean False on failure, true on supposed success
*/
function send_as_pdf()
{
global $objInit, $_ARRAYLANG;
if (!$this->load()) {
return \Message::error($_ARRAYLANG['TXT_SHOP_PRICELIST_ERROR_LOADING']);
}
$objPdf = new \Cezpdf('A4');
$objPdf->setEncryption('', '', array('print'));
$objPdf->selectFont(\Cx\Core\Core\Controller\Cx::instanciate()->getCodeBaseLibraryPath() . '/ezpdf/fonts/' . $this->font);
$objPdf->ezSetMargins(0, 0, 0, 0);
// Reset margins
$objPdf->setLineStyle(0.5);
$marginTop = 30;
$biggerCountTop = $biggerCountBottom = 0;
$arrHeaderLeft = $arrHeaderRight = $arrFooterLeft = $arrFooterRight = array();
if ($this->header) {
// header should be shown
$arrHeaderLeft = explode("\n", $this->header_left);
$arrHeaderRight = explode("\n", $this->header_right);
$countLeft = count($arrHeaderLeft);
$countRight = count($arrHeaderRight);
$biggerCountTop = $countLeft > $countRight ? $countLeft : $countRight;
$marginTop = $biggerCountTop * 14 + 36;
}
// Bottom margin
$marginBottom = 20;
$arrFooterRight = array();
if ($this->footer) {
// footer should be shown
// Old, obsolete:
$this->footer_left = str_replace('<--DATE-->', date(ASCMS_DATE_FORMAT_DATE, time()), $this->footer_left);
$this->footer_right = str_replace('<--DATE-->', date(ASCMS_DATE_FORMAT_DATE, time()), $this->footer_right);
// New:
$this->footer_left = str_replace('[DATE]', date(ASCMS_DATE_FORMAT_DATE, time()), $this->footer_left);
$this->footer_right = str_replace('[DATE]', date(ASCMS_DATE_FORMAT_DATE, time()), $this->footer_right);
$arrFooterLeft = explode("\n", $this->footer_left);
$arrFooterRight = explode("\n", $this->footer_right);
$countLeft = count($arrFooterLeft);
$countRight = count($arrFooterRight);
$biggerCountBottom = $countLeft > $countRight ? $countLeft : $countRight;
$marginBottom = $biggerCountBottom * 20 + 20;
}
// Borders
if ($this->border) {
$linesForAllPages = $objPdf->openObject();
$objPdf->saveState();
$objPdf->setStrokeColor(0, 0, 0, 1);
$objPdf->rectangle(10, 10, 575.28, 821.89);
$objPdf->restoreState();
$objPdf->closeObject();
$objPdf->addObject($linesForAllPages, 'all');
}
// Header
$headerArray = array();
$startpointY = 0;
if ($this->header) {
$objPdf->ezSetY(830);
$headerForAllPages = $objPdf->openObject();
$objPdf->saveState();
for ($i = 0; $i < $biggerCountTop; ++$i) {
$headerArray[$i] = array('left' => isset($arrHeaderLeft[$i]) ? $arrHeaderLeft[$i] : '', 'right' => isset($arrHeaderRight[$i]) ? $arrHeaderRight[$i] : '');
}
$tempY = $objPdf->ezTable($headerArray, '', '', array('showHeadings' => 0, 'fontSize' => $this->font_size_header, 'shaded' => 0, 'width' => 540, 'showLines' => 0, 'xPos' => 'center', 'xOrientation' => 'center', 'cols' => array('right' => array('justification' => 'right'))));
$tempY -= 5;
if ($this->border) {
$objPdf->setStrokeColor(0, 0, 0);
$objPdf->line(10, $tempY, 585.28, $tempY);
}
$startpointY = $tempY - 5;
$objPdf->restoreState();
$objPdf->closeObject();
$objPdf->addObject($headerForAllPages, 'all');
}
// Footer
$pageNumbersX = $pageNumbersY = $pageNumbersFont = 0;
if ($this->footer) {
$footerForAllPages = $objPdf->openObject();
$objPdf->saveState();
$tempY = $marginBottom - 5;
if ($this->border) {
$objPdf->setStrokeColor(0, 0, 0);
$objPdf->line(10, $tempY, 585.28, $tempY);
}
// length of the longest word
$longestWord = 0;
foreach ($arrFooterRight as $line) {
if ($longestWord < strlen($line)) {
$longestWord = strlen($line);
}
}
for ($i = $biggerCountBottom - 1; $i >= 0; --$i) {
//.........这里部分代码省略.........