<?php header('Content-Type: application/json'); error_reporting(0); require_once 'conexion.php'; require_once '../plugins/ezpdf/Cezpdf.php'; conectarse(); $pdf = new Cezpdf('a4'); $tmp = array('b' => 'Helvetica-Bold', 'i' => 'Courier-Oblique', 'bi' => 'Helvetica-BoldOblique', 'ib' => 'Helvetica-BoldOblique', 'bb' => 'Times-Roman'); $pdf->setFontFamily('Helvetica', $tmp); $pdf->selectFont('fonts/Helvetica.afm'); $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");
function init_pdf($pagesize, $orientation, $title) { global $layout; $diff = array(177 => 'aogonek', 161 => 'Aogonek', 230 => 'cacute', 198 => 'Cacute', 234 => 'eogonek', 202 => 'Eogonek', 241 => 'nacute', 209 => 'Nacute', 179 => 'lslash', 163 => 'Lslash', 182 => 'sacute', 166 => 'Sacute', 188 => 'zacute', 172 => 'Zacute', 191 => 'zdot', 175 => 'Zdot', 185 => 'scaron', 169 => 'Scaron', 232 => 'ccaron', 200 => 'Ccaron', 236 => 'edot', 204 => 'Edot', 231 => 'iogonek', 199 => 'Iogonek', 249 => 'uogonek', 217 => 'Uogonek', 254 => 'umacron', 222 => 'Umacron', 190 => 'zcaron', 174 => 'Zcaron'); $pdf = new Cezpdf($pagesize, $orientation); //landscape/portrait $pdf->isUnicode = true; $pdf->addInfo('Producer', 'LMS Developers'); $pdf->addInfo('Title', $title); $pdf->addInfo('Creator', 'LMS ' . $layout['lmsv']); $pdf->setPreferences('FitWindow', '1'); $pdf->ezSetMargins(PDF_MARGIN_TOP, PDF_MARGIN_BOTTOM, PDF_MARGIN_LEFT, PDF_MARGIN_RIGHT); $pdf->setLineStyle(0.5); $pdf->setFontFamily('arial', array('b' => 'arialbd')); $pdf->selectFont('arial', array('encoding' => 'WinAnsiEncoding', 'differences' => $diff), 1, true); return $pdf; }
define('PRODUCT_TABLE_LEFT_MARGIN', '2'); // Height of the product listing rectangles define('PRODUCT_TABLE_ROW_HEIGHT', '11'); // The column sizes are where the product listing columns start on the // PDF page, if you make the TABLE HEADER FONT SIZE any larger you will // need to tweak these values to prevent text from clashing together define('PRODUCTS_COLUMN_SIZE', '450'); define('PRODUCT_LISTING_BKGD_COLOR', GREY); define('MODEL_COLUMN_SIZE', '37'); define('PRICING_COLUMN_SIZES', '67'); $vilains = array("à", "á", "â", "ã", "ä", "å", "æ", "ç", "è", "é", "ê", "ë", "ì", "í", "î", "ï", "ð", "ñ", "ò", "ó", "ô", "õ", "ö", "÷", "ø", "ù", "ú", "û", "ü", "ý", "þ", "ÿ", "ß", "'", " ", "à", "á", "ã", "ä", "&Arond;", "è", "æ", "ê", "ë", "ì", "í", "Í", "î", "ï", "ò", "ó", "ô", "õ", "ö", "ø", "ù", "ú", "û", "ü", "ñ", "ç", "ý", "<", ">", "&"); $cools = array('à', 'á', 'â', 'ã', 'ä', 'å', 'æ', 'ç', 'è', 'é', 'ê', 'ë', 'ì', 'í', 'î', 'ï', 'ð', 'ñ', 'ò', 'ó', 'ô', 'õ', 'ö', '÷', 'ø', 'ù', 'ú', 'û', 'ü', 'ý', 'þ', 'ÿ', 'ß', '\'', ' ', 'à', 'á', 'ã', 'ä', 'å', 'è', 'æ', 'ê', 'ë', 'ì', 'í', 'î', 'Î', 'ï', 'ò', 'ó', 'ô', 'õ', 'ö', 'ø', 'ù', 'ú', 'û', 'ü', 'ñ', 'ç', 'ý', '<', '>', '&'); $currencies = new currencies(); //$pdf->setPreferences(array("HideToolbar" => 'false', "HideWindowUI" => 'false')); $pdf->selectFont(BATCH_PDF_DIR . 'Helvetica.afm'); $pdf->setFontFamily(BATCH_PDF_DIR . 'Helvetica.afm'); // company name and details pulled from the my store address and phone number // in admin configuration mystore $y = $pdf->ezText(STORE_NAME_ADDRESS, COMPANY_HEADER_FONT_SIZE); $y -= 10; // logo image set to right of the above .. change first number to move sideways //$pdf->addJpegFromFile(BATCH_PRINT_INC . 'templates/' . 'invoicelogo.jpg',365,730,85,85); // extra info boxs to be used by staff $pdf->setStrokeColor(0, 0, 0); $pdf->setLineStyle(0.5); $pdf->Rectangle(300, 745, 250, 70); $pdf->addText(310, 785, GENERAL_FONT_SIZE, TEXT_PACKED_BY); $pdf->addText(310, 760, GENERAL_FONT_SIZE, TEXT_VERIFIED_BY); // line between header order number and order date $pdf->setLineStyle(0.5); $pdf->line(LEFT_MARGIN, $y, LINE_LENGTH, $y);
$startRecord = 1 + $a * $recordsPerPage; if ($numRecords > $startRecord + $recordsPerPage) { $endRecord = $startRecord + $recordsPerPage - 1; } else { $endRecord = $numRecords - 1; } print "<li><a href=\"create_badge.php?USERS_PK[]=all&numRecords={$numRecords}&pageNumber={$a}\">PDF file for records {$startRecord}-{$endRecord}</a></li>"; } print "</ul>"; print "</div>"; } else { // this is the closest predefined page size matching the labels $pdf = new Cezpdf('LETTER', 'portrait'); $pdf->ezSetMargins($top_margin, $bottom_margin, $left_margin, $right_margin); $pdf->selectFont('../../accounts/include/fonts/Helvetica.afm'); $pdf->setFontFamily('b'); $pdf->addInfo("Creator", "Sakai Conference Badge Generator"); $pdf->addInfo("Author", "Educational Technologies at Virginia Tech"); $pdf->addInfo("Title", "Sakai Conference Badges"); $pdf->addInfo("CreationDate", localtime()); $pageCount = 0; $offsetRow = 2; foreach ($people as $person) { if ($pageCount > 0 && $offsetRow == 2) { $pdf->ezNewPage(); } for ($columnOffset = 0; $columnOffset <= 1; $columnOffset++) { $left_edge = $left_margin + $badge_width * $columnOffset + $margin; $right_edge = $left_edge + $badge_width - $margin * 2; $top_edge = $top_margin + ($offsetRow + 1) * $badge_height - $margin; $bottom_edge = $top_edge - $badge_height + $margin * 2;