public function download($page = 'noticeview') { define('FPDF_FONTPATH', APPPATH . 'plugins/fpdf/font/'); require APPPATH . 'plugins/fpdf/fpdf.php'; $this->load->helper('url'); if (!file_exists(APPPATH . '/views/noticeboard/' . $page . '.php')) { show_404(); } $data['title'] = ucfirst($page); // Capitalize the first letter $data['name'] = "Nayeem"; $id = $_GET['id']; $file = base_url() . 'uploads/' . $id . '.jpg'; $type = ".jpg"; if (@getimagesize($file)) { $size = getimagesize($file); } else { $type = ".png"; $file = base_url() . 'uploads/' . $id . '.png'; $size = getimagesize(base_url() . 'uploads/' . $id . '.png'); } //$pdf = new FPDF('p','mm',array(210,300)); if ($size[0] > $size[1]) { $style = 'l'; } else { $style = 'p'; } $pdf = new FPDF($style, 'pt', array($size[0] * 3 / 4, $size[1] * 3 / 4)); $pdf->AddPage(); $pdf->setDisplayMode('fullpage'); //$pdf -> Image(base_url().'uploads/'.$id.'.png',20,20,170,260); $pdf->Image(base_url() . 'uploads/' . $id . "" . $type, 0, 0, 0, 0); // $pdf -> setFont ('times','B',20); // $pdf -> cell(200,30,"Title",0,1); $pdf->setFont('times', 'B', '20'); $pdf->write(10, "{$size['0']}, {$size['1']}"); $pdf->output($id . '.pdf', 'D'); //header('Location: ' .base_url(). 'index.php/noticeview/show?id='.$id); }
//setting the start date for all transactions /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// if ($datefrom == NULL || $dateto == NULL) { $starting = "REVERSED TRANSACTIONS POSTED ON: " . date("F j, Y, g:i a"); } else { $starting = "REVERSED TRANSACTIONS AS FROM " . $datefrom . " TO " . $dateto; } /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// $this->Image('images/new.png',10,8,33); $pdf->Image('../images/logo.png', 180, 10, -300); $pdf->SetFont('Arial', 'B', 11); $pdf->SetTextColor(204, 102, 0); $pdf->Cell(40, 10, ' ' . $starting . ' AT ' . $branchname . ' BRANCH'); // Add date report ran $pdf->SetFont('HELVETICA', 'B', 10); $date = date("F j, Y"); $pdf->Cell(40, 30, 'Report date: ' . $date . ' REPORT BY: ' . $USER); $pdf->SetDrawColor(0, 0, 0); //black //table header $pdf->SetFillColor(102, 51, 0); $pdf->SetTextColor(252, 252, 252); $pdf->setFont("Arial", "B", "11"); $pdf->setXY(10, 40); $pdf->Cell(22, 10, "TRANS ID:", 1, 0, "L", 1); // my field headers $pdf->Cell(25, 10, "MEMBER #:", 1, 0, "L", 1); $pdf->Cell(55, 10, "FULL NAMES", 1, 0, "L", 1); $pdf->Cell(20, 10, "REF NO:", 1, 0, "L", 1); $pdf->Cell(30, 10, "TRANS DATE", 1, 0, "L", 1); $pdf->Cell(30, 10, "FUND NAME", 1, 0, "L", 1); $pdf->Cell(30, 10, "REASON", 1, 0, "L", 1);
<?php require_once "./fpdf/fpdf.php"; $pdf = new FPDF(); $pdf->addPage(); $pdf->setFont('Arial', 'B', 16); $pdf->cell(40, 10, 'Hello Out There!'); $pdf->output();
$sName = $this->db->query("SELECT `store_name` FROM `stores` WHERE `store_id` = {$term->store}")->first_row()->store_name; $employee_name = ucwords(strtolower("{$term->efname} {$term->elname}")); $manager_name = ucwords(strtolower("{$term->mfname} {$term->mlname}")); $rehire = "No"; if ($term->rehire == 1) { $rehire = "Yes"; } elseif ($term->rehire == 2) { $rehire = "Conditionally"; } $pdf = new FPDF(); $pdf->addFont('barCode39fHR', '', 'bar39fh.php'); $pdf->SetRightMargin(160); $pdf->SetTopMargin(118); $pdf->SetAutoPageBreak(TRUE, 62); $pdf->AddPage(); $pdf->setFont('barCode39fHR', '', 24); $pdf->Text(10, 20, "*4-{$tid}*"); $pdf->setFont('Arial', 'B', 18); $pdf->Text(15, 35, 'Voluntary Termination'); $pdf->setFont('Arial', '', 10); $pdf->Text(15, 40, "Employee: {$employee_name} ({$term->employee_id})"); $pdf->Text(15, 45, "Issued by: {$manager_name} ({$term->manager_id}) / {$sName}"); $pdf->Text(15, 55, "Termination Date:\t{$term->termination_date}"); $pdf->Text(15, 60, "Last Day: \t\t\t{$term->last_day_worked}"); $pdf->Text(15, 65, "Reason: {$term->reason_desc}"); $pdf->Text(100, 40, "Would you rehire? {$rehire}"); $pdf->Text(15, 275, "______________________________________________________"); $pdf->Text(25, 280, "Manager Signature Date"); if ($rehire != "Yes") { $pdf->SetXY(135, 45); $pdf->MultiCell(50, 4, "{$term->no_rehire_desc}", 1, 'J');
<?php require 'fpdf.php'; include "link.php"; $pdf = new FPDF('P', 'mm', 'A4'); $pdf->addPage(); $pdf->setFont('Times', 'B', 30, 'C'); $pdf->text(10, 15, 'Dynamic Link Library'); $pdf->setFont('Helvetica', 'I', 20, 'C'); $pdf->text(10, 22.5, 'Perpustakaan Online SMK Negeri 10 Jakarta'); $pdf->setFont('Helvetica', '', 20, 'C'); $pdf->text(10, 32, 'Laporan Buku'); $pdf->text(10, 22.5, 'Perpustakaan Online SMK Negeri 10 Jakarta'); $pdf->setFont('Helvetica', '', 15, 'C'); $pdf->text(10, 39, 'Bulan ' . $_GET[bulan]); $yi = 50; $ya = 44; $pdf->setFont('Arial', '', 9); $pdf->setFillColor(183, 199, 93); $pdf->setXY(10, $ya); $pdf->CELL(10, 6, 'No', 1, 0, 'C', 1); $pdf->CELL(20, 6, 'ID', 1, 0, 'C', 1); $pdf->CELL(80, 6, 'Judul', 1, 0, 'C', 1); $pdf->CELL(60, 6, 'Rak', 1, 0, 'C', 1); $pdf->CELL(20, 6, 'Jumlah', 1, 0, 'C', 1); $ya = $yi + $row; $sql = mysql_query("select*from buku"); $i = 1; $no = 1; $max = 31; $row = 6;
/** * generatePDF - Génère un fichier PDF à partir des données d'évaluation d'un service * * @category : eval_ccpc_functions * @param array $data Données d'évaluation récupérées à partir de la fonction {@link getEvaluationCCPCFullData()} * @param boolean $comment TRUE si on incut les commentaire, FALSE si on ne les inclut pas * @param boolean $commentMSG TRUE si on incut un message concernant la CSG, FALSE si on ne l'inclut pas * @return array Array contenant les informations du fichier généré * * @Author Ali Bellamine * * Contenu de l'array retourné :<br> * ['pdfPath'] => (string) Chemin local vers le fichier généré<br> * ['pdfURI'] => (string) URI pointant vers le fichier généré * */ function generatePDF($data, $comment = FALSE, $commentMSG = FALSE) { // Accès à la BDD global $db; // Array contenant les résultats $output = array(); // On vérifie l'existence des données if (isset($data) && count($data) > 0) { /* Mise en cache */ // Calcul du md5 $hashdata = $data; $hashdata['optionsPDF'] = array('comment' => $comment, 'commentMSG' => $commentMSG); $hash = md5(json_encode($hashdata)); $pdfPath = PLUGIN_PATH . 'cache/' . $hash . '.pdf'; $pdfPathURI = ROOT . 'evaluations/ccpc/cache/' . $hash . '.pdf'; if (is_file($pdfPath)) { $output['pdfPath'] = $pdfPath; $output['pdfURI'] = $pdfPathURI; return $output; } else { // On charge la librairie require_once PLUGIN_PATH . 'core/fpdf17/fpdf.php'; // On charge le fichier XML if (is_file(PLUGIN_PATH . 'formulaire.xml')) { $form = simplexml_load_file(PLUGIN_PATH . 'formulaire.xml'); } // Promotion if (count($data['service']['promotion']) > 1) { $promotion = false; } else { foreach ($data['service']['promotion'] as $promotionData) { $promotion = $promotionData['id']; } } try { ob_end_clean(); } catch (Exception $e) { } // On crée le PDF $A4Height = 842; $A4Width = 595; $titleSize = 15; $textSize = 11; $pdf = new FPDF('L', 'pt', 'A4'); $pdf->SetTopMargin(10); $pdf->SetLeftMargin(15); $pdf->SetAutoPageBreak(TRUE, 10); /** Page contenant le résumé des données d'évaluation **/ $pdf->AddPage(); $pdf->SetFont('Arial', 'B', $titleSize); // On affiche le titre $pdf->SetFillColor(70, 70, 242); $pdf->SetTextColor(255, 255, 255); $pdf->SetX(floor(0.1 * $A4Height)); $pdf->Cell(floor(0.8 * $A4Height), $titleSize + 5, utf8_decode(LANG_FORM_CCPC_PDF_TITLE), 'LRTB', 0, 'C', TRUE); // Première ligne $pdf->Ln(2 * $titleSize); $pdf->SetFont('Arial', '', $textSize); // On affiche les informations concernant le service // Récupération des données $textToDisplay = LANG_FORM_CCPC_FILTER_SERVICE_TITLE . ' : ' . $data['service']['FullName'] . PHP_EOL . LANG_FORM_CCPC_PDF_STAGEPERIODE . ' : ' . date('d/m/Y', $data['service']['date']['min']) . ' - ' . date('d/m/Y', $data['service']['date']['max']); // Nombre d'étudiants par promotion $nbEtudiantsService = array(); $sql = 'SELECT p.nom promotion, COUNT( ae.userId ) nombre FROM `affectationexterne` ae INNER JOIN user u ON u.id = ae.userId INNER JOIN promotion p ON p.id = u.promotion WHERE `dateDebut` >= "' . TimestampToDatetime($data['service']['date']['min']) . '" AND `dateFin` <= "' . TimestampToDatetime($data['service']['date']['max']) . '" AND service = ' . $data['service']['id'] . ' GROUP BY u.promotion'; $res = $db->query($sql); while ($res_f = $res->fetch()) { $nbEtudiantsService[$res_f['promotion']] = $res_f['nombre']; } $firstLoop = true; if (count($nbEtudiantsService) > 0) { $textToDisplay .= PHP_EOL . LANG_FORM_CCPC_PDF_STUDENTPROMOTION . ' : '; foreach ($nbEtudiantsService as $promotionNom => $promotionNombre) { if (!$firstLoop) { $textToDisplay .= ', '; } else { $firstLoop = FALSE; } $textToDisplay .= $promotionNom . ' (' . $promotionNombre . ')'; } } $textToDisplay .= PHP_EOL . LANG_FORM_CCPC_PDF_STUDENTNB . ' : ' . $data['service']['nbEvaluation'] . PHP_EOL . LANG_FORM_CCPC_PDF_EVALUATIONNB . ' : ' . $data['nb']; $textToDisplay = utf8_decode($textToDisplay); // Affichage $pdf->SetFillColor(231, 231, 231); $pdf->SetTextColor(0, 0, 0); $pdf->MultiCell(floor(0.35 * $A4Height), $textSize + 5, $textToDisplay, 'LRTB', 'L', TRUE); // On affiche les graphiques : mainGraphPDF // Récupération des données // Liste des graphiques à afficher $input = $form->xpath('categorie/input[@mainPDFGraph="1"]'); $nbGraph = count($input); // Nombre de graphiques à intégrer // On génère $tempData, contenant les données utilisées pour génération du png foreach ($input as $select) { if ($select['type'] == 'select') { $categorie = $select->xpath('..')[0]; // Catégorie du graphique $tempData = array(); $tempData['settings'] = array('width' => 450, 'height' => 230); foreach ($select->option as $option) { if (isset($data[(string) $categorie['nom']][(string) $select['nomBDD']]['nb'][(string) $option['value']])) { $value = $data[(string) $categorie['nom']][(string) $select['nomBDD']]['nb'][(string) $option['value']]; if (is_numeric($value)) { $tempData['data'][constant((string) $option['text'])] = $value; } else { $tempData['data'][constant((string) $option['text'])] = 0; } } else { $tempData['data'][constant((string) $option['text'])] = 0; } } // On inclut l'image $pdf->Image(eval_ccpc_genGraphPie($tempData), 0.4 * $A4Height, 3 * $titleSize, floor(0.4 * $A4Height), 0, 'PNG'); break; } } // On affiche l'icone des filtres : maximum 4 $filtres = eval_ccpc_checkFilterExistence($data['service']['id'], $data['service']['date']['min'], $data['service']['date']['max'], $promotion); $numberOfIcons = 0; // Compte le nombre d'icones ajoutées $leftCornerX = 0.8 * $A4Height - 5; $leftCornerY = 3 * $titleSize - 5; if (is_array($filtres)) { foreach ($filtres as $filtre) { if (isset($filtre['icone']) && strlen($filtre['icone']) > 1 && $numberOfIcons < 4) { $pdf->Image($filtre['icone'], $leftCornerX, $leftCornerY, floor(0.1 * $A4Height), 0, 'PNG'); $numberOfIcons++; if ($numberOfIcons == 1) { $leftCornerX = 0.9 * $A4Height - 3; } else { if ($numberOfIcons == 2) { $leftCornerX = 0.8 * $A4Height - 5; $leftCornerY += 0.1 * $A4Height + 1; } else { if ($numberOfIcons == 3) { $leftCornerX = 0.9 * $A4Height - 3; } } } break; } } } if ($numberOfIcons == 0) { // On ajoute l'icone neutre si aucune icone n'est présente $pdf->Image(PLUGIN_PATH . '/css/img/neutral.png', $leftCornerX, $leftCornerY, floor(0.1 * $A4Height), 0, 'PNG'); } // Deuxième ligne $pdf->Ln(8 * $titleSize); // On affiche le radar sur 1 an de données $fullYearData = getEvaluationCCPCFullData($data['service']['id'], $promotion, $data['service']['date']['max'] - 31536000, $data['service']['date']['max'], FALSE); // Récupération des données // Titre $pdf->Cell(floor(0.4 * $A4Height), $titleSize + 5, utf8_decode(LANG_FORM_CCPC_PDF_STAGEPERIODE_FULLYEAR . ' (' . date('d/m/Y', $fullYearData['service']['date']['min']) . ' ' . LANG_FORM_CCPC_PDF_STAGEPERIODE_END . ' ' . date('d/m/Y', $fullYearData['service']['date']['max']) . ')'), 0, 0, 'C', FALSE); // On affiche l'image // Liste des valeurs à afficher $input = $form->xpath('categorie/input[@radarPDFGraph="1"]'); // Préparation des données $tempData = array(); $tempData['settings'] = array('height' => 380, 'width' => 680, 'max' => 10); foreach ($input as $theinput) { // Récupération du parent $categorie = $theinput->xpath('..')[0]; // Catégorie du graphique if (isset($data[(string) $categorie['nom']][(string) $theinput['nomBDD']]['moyenne'])) { $tempData['data'][constant($theinput['label'] . '_SHORT')] = $fullYearData[(string) $categorie['nom']][(string) $theinput['nomBDD']]['moyenne'] + 5; } } // Affichage de l'image $pdf->Image(eval_ccpc_genGraphRadar($tempData), 10, $pdf->getY() + 40, floor(0.4 * $A4Height), 0, 'PNG'); // On affiche le radar sur la période du stage // On décale du 0.05*largeur $pdf->Cell(floor(0.05 * $A4Height)); // On crée un rectangle contenant les données $pdf->Rect($pdf->getX(), $pdf->getY() - 10, 0.5 * $A4Height, 0.3 * $A4Height, 'F'); // Titre $pdf->Cell(floor(0.5 * $A4Height), $titleSize + 5, utf8_decode(LANG_FORM_CCPC_PDF_STAGEPERIODE_START . ' ' . date('d/m/Y', $data['service']['date']['min']) . ' ' . LANG_FORM_CCPC_PDF_STAGEPERIODE_END . ' ' . date('d/m/Y', $data['service']['date']['max'])), 0, 0, 'C', FALSE); // On ajoute l'image // Liste des valeurs à afficher $input = $form->xpath('categorie/input[@radarPDFGraph="1"]'); // Préparation des données $tempData = array(); $tempData['settings'] = array('height' => 380, 'width' => 650, 'max' => 10); foreach ($input as $theinput) { // Récupération du parent $categorie = $theinput->xpath('..')[0]; // Catégorie du graphique if (isset($data[(string) $categorie['nom']][(string) $theinput['nomBDD']]['moyenne'])) { $tempData['data'][constant($theinput['label'] . '_SHORT')] = $data[(string) $categorie['nom']][(string) $theinput['nomBDD']]['moyenne'] + 5; } } // Affichage de l'image $pdf->Image(eval_ccpc_genGraphRadar($tempData), $pdf->getX() - 0.45 * $A4Height, $pdf->getY() + 40, floor(0.4 * $A4Height), 0, 'PNG'); // Affiche du logo $pdf->Image(ROOT . 'theme/img/logo.png', 10, $A4Width - 100, 0, 50, 'PNG'); // Pied de Page $pdf->SetX(0.5 * $A4Height); $pdf->SetY($A4Width - 40); $textSize = 10; $pdf->SetFont('Arial', 'I', $textSize); // Ligne de demarcation $pdf->Line(15, $pdf->getY(), $A4Height - 15, $pdf->getY()); // Accès aux résultats $pdf->SetX(0.5 * $A4Height); $pdf->Cell(0.5 * $A4Height - 15, $textSize + 5, utf8_decode(LANG_FORM_CCPC_PDF_FOOTER_FULLRESULT . ' ' . getPageUrl('evalView', array('evaluationType' => 1, 'service' => $data['service']['id']))), 0, 1, 'R', 0); // Coordonées CSG if ($commentMSG) { $pdf->SetFont('Arial', 'B', $textSize); $pdf->SetX(15); $pdf->Cell($A4Height - 15, $textSize + 5, utf8_decode(LANG_FORM_CCPC_PDF_FOOTER_STRUCTURENAME . ' - ' . CONTACT_STAGE_MAIL), 0, 0, 'C', 0); } /** Commentaires **/ // Ajout des commentaires, points positifs et points négatifs : 'pdfComment' if ($comment) { $pdf->addPage('P', 'A4'); // Titre $pdf->SetFont('Arial', 'B', $titleSize); $pdf->SetFillColor(70, 70, 242); $pdf->SetTextColor(255, 255, 255); $pdf->SetX(floor(0.1 * $A4Width)); $pdf->Cell(floor(0.8 * $A4Width), $titleSize + 5, utf8_decode(LANG_FORM_CCPC_PDF_COMMENT_TITLE), 'LRTB', 1, 'C', TRUE); $pdf->SetTextColor(0, 0, 0); $pdf->SetFillColor(245, 245, 245); // Les commentaires $input = $form->xpath('categorie/input[@pdfComment="1"]'); foreach ($input as $theinput) { $categorie = $theinput->xpath('..')[0]; if ($theinput['type'] == 'text') { // Création de l'array contenant les données à afficher sous forme [timestamp fin][timestamp début][timestamp commantaire][idMessage][] => message $tempData = array(); foreach ($theinput->text as $value) { if (isset($data[(string) $categorie['nom']][(string) $value['nomBDD']])) { foreach ($data[(string) $categorie['nom']][(string) $value['nomBDD']] as $idEval => $textValue) { if (isset($data['donnees'][$idEval]['infos'])) { $tempData[$data['donnees'][$idEval]['infos']['dateFin']][$data['donnees'][$idEval]['infos']['dateDebut']][$data['donnees'][$idEval]['infos']['date']][$idEval][] = $textValue; } } } } $textArea = ''; $firstLoop = TRUE; // On affiche les commentaires krsort($tempData); foreach ($tempData as $dateFin => $tempvalue) { krsort($tempvalue); foreach ($tempvalue as $dateDebut => $value2) { krsort($value2); foreach ($value2 as $date => $value3) { foreach ($value3 as $commentId => $comments) { foreach ($comments as $comment) { if ($comment != '') { if (!$firstLoop) { $textArea .= PHP_EOL . PHP_EOL; } else { $firstLoop = FALSE; } // Saut de ligne $textArea .= $comment . ' - ' . date('d/m/Y', $date) . ' #' . $commentId; } } } } } } if ($textArea != '') { // On affiche les textes dans le PDF $pdf->Ln(20); $pdf->SetX(20); $pdf->setFont('Arial', '', $titleSize); $pdf->Cell(0, $titleSize + 5, utf8_decode(constant($theinput['label'] . '_SHORT')), 0, 1, 'L', FALSE); $pdf->setFont('Arial', '', $textSize); $pdf->SetX(20); $pdf->MultiCell($A4Width - 40, $textSize + 5, utf8_decode($textArea), 'LTRB', 'L', TRUE); } } else { if ($theinput['type'] == 'textarea') { // Création de l'array contenant les données à afficher sous forme [timestamp fin][timestamp début][timestamp commantaire][idCommentaire] => commentaire $tempData = array(); foreach ($data[(string) $categorie['nom']][(string) $theinput['nomBDD']] as $commentId => $commentData) { if (isset($data['donnees'][$commentId]['infos'])) { $tempData[$data['donnees'][$commentId]['infos']['dateFin']][$data['donnees'][$commentId]['infos']['dateDebut']][$data['donnees'][$commentId]['infos']['date']][$commentId] = $commentData; } } $textArea = ''; $firstLoop = TRUE; // On affiche les commentaires krsort($tempData); foreach ($tempData as $dateFin => $tempvalue) { krsort($tempvalue); foreach ($tempvalue as $dateDebut => $value2) { krsort($value2); foreach ($value2 as $date => $value3) { foreach ($value3 as $commentId => $comment) { if ($comment != '') { if (!$firstLoop) { $textArea .= PHP_EOL . PHP_EOL; } else { $firstLoop = FALSE; } // Saut de ligne $textArea .= $comment . ' - ' . date('d/m/Y', $date) . ' #' . $commentId; } } } } } if ($textArea != '') { // On affiche les textes dans le PDF $pdf->Ln(20); $pdf->SetX(20); $pdf->setFont('Arial', '', $titleSize); $pdf->Cell(0 * $A4Width, $titleSize + 5, utf8_decode(constant($theinput['label'] . '_SHORT')), 0, 1, 'L', FALSE); $pdf->setFont('Arial', '', $textSize); $pdf->SetX(20); $pdf->MultiCell($A4Width - 40, $textSize + 5, utf8_decode($textArea), 'LTRB', 'L', TRUE); } } } } } // On retourne le fichier PDF $pdf->Output($pdfPath, 'F'); $output['pdfPath'] = $pdfPath; $output['pdfURI'] = $pdfPathURI; return $output; } exit; } else { return FALSE; } }
/** * Print tickets as PDF documents * Tickets can be printed for an event, a single occurrence, * or all tickets for a user ID. * * @param string $ev_id Event ID * @param integer $rp_id Repeat ID * @param integer $uid User ID * @return string PDF Document containing tickets */ public static function PrintTickets($ev_id = '', $rp_id = 0, $uid = 0) { global $_CONF; $checkin_url = $_CONF['site_admin_url'] . '/plugins/evlist/checkin.php?tic='; // get the tickets, paid and unpaid. Need event id and uid. $tickets = self::GetTickets($ev_id, $rp_id, $uid); // The PDF functions in lgLib are a recent addition. Make sure that // the lgLib version supports PDF creation since we can't yet check // the lglib version during installation if (empty($tickets) || !function_exists('USES_lglib_class_fpdf')) { return "There are no tickets available to print"; } USES_lglib_class_fpdf(); USES_evlist_class_repeat(); USES_evlist_class_tickettype(); $ev_id = NULL; // create params array for qrcode, if used $params = array('module_size' => 5); $pdf = new FPDF(); $pdf->SetLeftMargin(20); $pdf->AddPage(); $tic_types = array(); foreach ($tickets as $tic_id => $ticket) { if (!isset($tick_types[$ticket->tic_type])) { $tick_types[$ticket->tic_type] = new evTicketType($ticket->tic_type); } // If we don't already have the event info, get it and construct // the address string if ($ev_id != $ticket->ev_id) { $Ev = new evEvent($ticket->ev_id); $ev_id = $Ev->id; $addr = array(); if ($Ev->Detail->street != '') { $addr[] = $Ev->Detail->street; } if ($Ev->Detail->city != '') { $addr[] = $Ev->Detail->city; } if ($Ev->Detail->province != '') { $addr[] = $Ev->Detail->province; } if ($Ev->Detail->country != '') { $addr[] = $Ev->Detail->country; } if ($Ev->Detail->postal != '') { $addr[] = $Ev->Detail->postal; } $address = implode(' ', $addr); } // Get the repeat(s) for the ticket(s) to print a ticket for each // occurrence. $repeats = evRepeat::GetRepeats($ticket->ev_id, $ticket->rp_id); foreach ($repeats as $rp_id => $event) { $ev_date = $event->date_start; $ev_time = $event->time_start1 . ' - ' . $event->time_end1; if (!empty($event->time_start2)) { $ev_time .= '; ' . $event->time_start1 . ' - ' . $event->time_end2; } $fee = self::formatAmount($ticket->fee); // Get the veritcal position of the current ticket // for positioning the qrcode $y = $pdf->GetY(); // Title $pdf->SetFont('Times', 'B', 12); $pdf->Cell(130, 10, "{$tick_types[$ticket->tic_type]->description}: {$Ev->Detail->title}", 1, 0, 'C'); $pdf->Ln(13); $pdf->SetFont('Times', '', 12); $pdf->SetX(-40); $pdf->Cell(0, 30, 'Fee: ' . $fee); if ($ticket->fee > 0) { $pdf->Ln(5); if ($ticket->paid >= $ticket->fee) { $pdf->SetX(-40); $pdf->Cell(0, 30, 'Paid'); } else { $pdf->SetX(-55); $due = $ticket->fee - $ticket->paid; $pdf->Cell(0, 30, 'Balance Due: ' . self::formatAmount($due)); } } $pdf->SetX(20); $pdf->Cell(0, 8, "Date:", 0, 0); $pdf->setX(40); $pdf->Cell(0, 8, $ev_date, 0, 1); $pdf->Cell(0, 6, "Time:", 0, 0); $pdf->SetX(40); $pdf->Cell(0, 6, $ev_time, 0, 1); if ($Ev->Detail->location != '') { $pdf->Ln(5); $pdf->Cell(0, 2, 'Where: ', 0, 0); $pdf->SetX(40); $pdf->Cell(0, 2, $Ev->Detail->location, 0, 1); } if (!empty($address)) { if ($Ev->Detail->location == '') { $pdf->Ln(5); $pdf->Cell(0, 2, 'Where: ', 0, 0); } $pdf->Ln(4); $pdf->SetX(40); $pdf->Cell(0, 2, $address, 0, 1); } // Footer $pdf->Ln(6); $pdf->setFont('Times', 'I', 10); $pdf->Cell(0, 10, $_CONF['site_name'], 0, 0); $pdf->Ln(6); $pdf->Cell(0, 10, $ticket->tic_id); // print qrcode if possible $params['data'] = $checkin_url . $tic_id . '&rp=' . $rp_id; $qrc_status = LGLIB_invokeService('qrcode', 'getcode', $params, $qrcode, $svc_msg); if ($qrc_status == PLG_RET_OK) { $pdf->SetX(-40); $pdf->Image($qrcode['path'], null, $y, 25); } $pdf->Ln(); $y = $pdf->GetY(); $pdf->Line(10, $y, 200, $y); $pdf->Ln(); } } $pdf->Output(); }
/** * generatePDF - Génère un fichier PDF à partir des données d'évaluation d'un service * * @category : eval_ccpc_functions * @param array $data Données d'évaluation récupérées à partir de la fonction {@link getEvaluationCCPCFullData()} * @param boolean $comment TRUE si on incut les commentaire, FALSE si on ne les inclut pas * @param boolean $commentMSG TRUE si on incut un message concernant la CSG, FALSE si on ne l'inclut pas * @return array Array contenant les informations du fichier généré * * @Author Ali Bellamine * * Contenu de l'array retourné :<br> * ['pdfPath'] => (string) Chemin local vers le fichier généré<br> * ['pdfURI'] => (string) URI pointant vers le fichier généré * */ function generatePDF($data, $comment = FALSE, $commentMSG = FALSE) { // Array contenant les résultats $output = array(); // On vérifie l'existence des données if (isset($data) && count($data) > 0) { /* Mise en cache */ // Calcul du md5 $hashdata = $data; $hashdata['optionsPDF'] = array('comment' => $comment, 'commentMSG' => $commentMSG); $hash = md5(json_encode($hashdata)); $pdfPath = PLUGIN_PATH . 'cache/' . $hash . '.pdf'; $pdfPathURI = ROOT . 'evaluations/ccpc/cache/' . $hash . '.pdf'; if (is_file($pdfPath)) { $output['pdfPath'] = $pdfPath; $output['pdfURI'] = $pdfPathURI; return $output; } else { // On charge la librairie require_once PLUGIN_PATH . 'core/fpdf17/fpdf.php'; // On charge le fichier XML if (is_file(PLUGIN_PATH . 'formulaire.xml')) { $form = simplexml_load_file(PLUGIN_PATH . 'formulaire.xml'); } // Promotion if (count($data['service']['promotion']) > 1) { $promotion = false; } else { foreach ($data['service']['promotion'] as $promotionData) { $promotion = $promotionData['id']; } } ob_end_clean(); // On crée le PDF $A4Height = 842; $A4Width = 595; $titleSize = 15; $textSize = 11; $pdf = new FPDF('L', 'pt', 'A4'); $pdf->SetTopMargin(10); $pdf->SetLeftMargin(15); $pdf->SetAutoPageBreak(TRUE, 10); /** Page contenant le résumé des données d'évaluation **/ $pdf->AddPage(); $pdf->SetFont('Arial', 'B', $titleSize); // On affiche le titre $pdf->SetFillColor(70, 70, 242); $pdf->SetTextColor(255, 255, 255); $pdf->SetX(floor(0.1 * $A4Height)); $pdf->Cell(floor(0.8 * $A4Height), $titleSize + 5, utf8_decode(LANG_FORM_CCPC_PDF_TITLE), 'LRTB', 0, 'C', TRUE); // Première ligne $pdf->Ln(2 * $titleSize); $pdf->SetFont('Arial', '', $textSize); // On affiche les informations concernant le service // Récupération des données $textToDisplay = LANG_FORM_CCPC_FILTER_SERVICE_TITLE . ' : ' . $data['service']['FullName'] . PHP_EOL . LANG_FORM_CCPC_PDF_STAGEPERIODE . ' : ' . date('d/m/Y', $data['service']['date']['min']) . ' - ' . date('d/m/Y', $data['service']['date']['max']) . PHP_EOL . LANG_FORM_CCPC_PDF_STUDENTPROMOTION . ' : '; $firstLoop = true; foreach ($data['service']['promotion'] as $promotionData) { if (!$firstLoop) { $textToDisplay .= ', '; } else { $firstLoop = FALSE; } $textToDisplay .= $promotionData['nom'] . ' (' . $promotionData['nb'] . ')'; } $textToDisplay .= PHP_EOL . LANG_FORM_CCPC_PDF_STUDENTNB . ' : ' . $data['service']['nbEvaluation'] . PHP_EOL . LANG_FORM_CCPC_PDF_EVALUATIONNB . ' : ' . $data['nb']; $textToDisplay = utf8_decode($textToDisplay); // Affichage $pdf->SetFillColor(231, 231, 231); $pdf->SetTextColor(0, 0, 0); $pdf->MultiCell(floor(0.35 * $A4Height), $textSize + 5, $textToDisplay, 'LRTB', 'L', TRUE); // On affiche les graphiques : mainGraphPDF // Récupération des données // Liste des graphiques à afficher $input = $form->xpath('categorie/input[@mainPDFGraph="1"]'); $nbGraph = count($input); // Nombre de graphiques à intégrer // On génère $tempData, contenant les données utilisées pour génération du png foreach ($input as $select) { if ($select['type'] == 'select') { $categorie = $select->xpath('..')[0]; // Catégorie du graphique $tempData = array(); $tempData['settings'] = array('width' => 450, 'height' => 230); foreach ($select->option as $option) { if (isset($data[(string) $categorie['nom']][(string) $select['nomBDD']]['nb'][(string) $option['value']])) { $value = $data[(string) $categorie['nom']][(string) $select['nomBDD']]['nb'][(string) $option['value']]; if (is_numeric($value)) { $tempData['data'][constant((string) $option['text'])] = $value; } else { $tempData['data'][constant((string) $option['text'])] = 0; } } else { $tempData['data'][constant((string) $option['text'])] = 0; } } // On inclut l'image $pdf->Image(eval_ccpc_genGraphPie($tempData), 0.4 * $A4Height, 3 * $titleSize, floor(0.4 * $A4Height), 0, 'PNG'); break; } } // On affiche l'icone des filtres $filtres = eval_ccpc_checkFilterExistence($data['service']['id'], $data['service']['date']['min'], $data['service']['date']['max'], $promotion); if (is_array($filtres)) { foreach ($filtres as $filtre) { if (isset($filtre['icone'])) { $pdf->Image($filtre['icone'], 0.8 * $A4Height, 3 * $titleSize, floor(0.2 * $A4Height), 0, 'PNG'); break; } } } // Deuxième ligne $pdf->Ln(8 * $titleSize); // On affiche le radar sur 1 an de données $fullYearData = getEvaluationCCPCFullData($data['service']['id'], $promotion, $data['service']['date']['max'] - 31536000, $data['service']['date']['max'], FALSE); // Récupération des données // Titre $pdf->Cell(floor(0.4 * $A4Height), $titleSize + 5, utf8_decode(LANG_FORM_CCPC_PDF_STAGEPERIODE_FULLYEAR . ' (' . date('d/m/Y', $fullYearData['service']['date']['min']) . ' ' . LANG_FORM_CCPC_PDF_STAGEPERIODE_END . ' ' . date('d/m/Y', $fullYearData['service']['date']['max']) . ')'), 0, 0, 'C', FALSE); // On affiche l'image // Liste des valeurs à afficher $input = $form->xpath('categorie/input[@radarPDFGraph="1"]'); // Préparation des données $tempData = array(); $tempData['settings'] = array('height' => 380, 'width' => 680, 'max' => 10); foreach ($input as $theinput) { // Récupération du parent $categorie = $theinput->xpath('..')[0]; // Catégorie du graphique if (isset($data[(string) $categorie['nom']][(string) $theinput['nomBDD']]['moyenne'])) { $tempData['data'][constant($theinput['label'] . '_SHORT')] = $fullYearData[(string) $categorie['nom']][(string) $theinput['nomBDD']]['moyenne'] + 5; } } // Affichage de l'image $pdf->Image(eval_ccpc_genGraphRadar($tempData), 10, $pdf->getY() + 40, floor(0.4 * $A4Height), 0, 'PNG'); // On affiche le radar sur la période du stage // On décale du 0.05*largeur $pdf->Cell(floor(0.05 * $A4Height)); // On crée un rectangle contenant les données $pdf->Rect($pdf->getX(), $pdf->getY() - 10, 0.5 * $A4Height, 0.3 * $A4Height, 'F'); // Titre $pdf->Cell(floor(0.5 * $A4Height), $titleSize + 5, utf8_decode(LANG_FORM_CCPC_PDF_STAGEPERIODE_START . ' ' . date('d/m/Y', $data['service']['date']['min']) . ' ' . LANG_FORM_CCPC_PDF_STAGEPERIODE_END . ' ' . date('d/m/Y', $data['service']['date']['max'])), 0, 0, 'C', FALSE); // On ajoute l'image // Liste des valeurs à afficher $input = $form->xpath('categorie/input[@radarPDFGraph="1"]'); // Préparation des données $tempData = array(); $tempData['settings'] = array('height' => 380, 'width' => 650, 'max' => 10); foreach ($input as $theinput) { // Récupération du parent $categorie = $theinput->xpath('..')[0]; // Catégorie du graphique if (isset($data[(string) $categorie['nom']][(string) $theinput['nomBDD']]['moyenne'])) { $tempData['data'][constant($theinput['label'] . '_SHORT')] = $data[(string) $categorie['nom']][(string) $theinput['nomBDD']]['moyenne'] + 5; } } // Affichage de l'image $pdf->Image(eval_ccpc_genGraphRadar($tempData), $pdf->getX() - 0.45 * $A4Height, $pdf->getY() + 40, floor(0.4 * $A4Height), 0, 'PNG'); // Affiche du logo $pdf->Image(ROOT . 'theme/img/logo.png', 10, $A4Width - 100, 0, 50, 'PNG'); // Pied de Page $pdf->SetX(0.5 * $A4Height); $pdf->SetY($A4Width - 40); $textSize = 10; $pdf->SetFont('Arial', 'I', $textSize); // Ligne de demarcation $pdf->Line(15, $pdf->getY(), $A4Height - 15, $pdf->getY()); // Accès aux résultats $pdf->SetX(0.5 * $A4Height); $pdf->Cell(0.5 * $A4Height - 15, $textSize + 5, utf8_decode(LANG_FORM_CCPC_PDF_FOOTER_FULLRESULT . ' ' . getPageUrl('evalView', array('evaluationType' => 1, 'service' => $data['service']['id']))), 0, 1, 'R', 0); // Coordonées CSG if ($commentMSG) { $pdf->SetFont('Arial', 'B', $textSize); $pdf->SetX(15); $pdf->Cell($A4Height - 15, $textSize + 5, utf8_decode(LANG_FORM_CCPC_PDF_FOOTER_STRUCTURENAME . ' - ' . CONTACT_STAGE_MAIL), 0, 0, 'C', 0); } /** Commentaires **/ // Ajout des commentaires, points positifs et points négatifs : 'pdfComment' if ($comment) { $pdf->addPage('P', 'A4'); // Titre $pdf->SetFont('Arial', 'B', $titleSize); $pdf->SetFillColor(70, 70, 242); $pdf->SetTextColor(255, 255, 255); $pdf->SetX(floor(0.1 * $A4Width)); $pdf->Cell(floor(0.8 * $A4Width), $titleSize + 5, utf8_decode(LANG_FORM_CCPC_PDF_COMMENT_TITLE), 'LRTB', 1, 'C', TRUE); $pdf->SetTextColor(0, 0, 0); $pdf->SetFillColor(245, 245, 245); // Les commentaires $input = $form->xpath('categorie/input[@pdfComment="1"]'); foreach ($input as $theinput) { $categorie = $theinput->xpath('..')[0]; if ($theinput['type'] == 'text') { $textArea = ''; $firstLoop = TRUE; foreach ($theinput->text as $text) { if (isset($data[(string) $categorie['nom']][(string) $text['nomBDD']])) { foreach ($data[(string) $categorie['nom']][(string) $text['nomBDD']] as $comment) { if ($comment != '') { if (!$firstLoop) { $textArea .= PHP_EOL . PHP_EOL; } else { $firstLoop = FALSE; } // Saut de ligne $textArea .= $comment; } } } } if ($textArea != '') { // On affiche les textes dans le PDF $pdf->Ln(20); $pdf->SetX(20); $pdf->setFont('Arial', '', $titleSize); $pdf->Cell(0, $titleSize + 5, utf8_decode(constant($theinput['label'] . '_SHORT')), 0, 1, 'L', FALSE); $pdf->setFont('Arial', '', $textSize); $pdf->SetX(20); $pdf->MultiCell($A4Width - 40, $textSize + 5, utf8_decode($textArea), 'LTRB', 'L', TRUE); } } else { if ($theinput['type'] == 'textarea') { $textArea = ''; $firstLoop = TRUE; if (isset($data[(string) $categorie['nom']][(string) $theinput['nomBDD']])) { foreach ($data[(string) $categorie['nom']][(string) $theinput['nomBDD']] as $comment) { if (!$firstLoop) { $textArea .= PHP_EOL . PHP_EOL; } else { $firstLoop = FALSE; } // Saut de ligne $textArea .= $comment; } } if ($textArea != '') { // On affiche les textes dans le PDF $pdf->Ln(20); $pdf->SetX(20); $pdf->setFont('Arial', '', $titleSize); $pdf->Cell(0 * $A4Width, $titleSize + 5, utf8_decode(constant($theinput['label'] . '_SHORT')), 0, 1, 'L', FALSE); $pdf->setFont('Arial', '', $textSize); $pdf->SetX(20); $pdf->MultiCell($A4Width - 40, $textSize + 5, utf8_decode($textArea), 'LTRB', 'L', TRUE); } } } } } // On retourne le fichier PDF $pdf->Output($pdfPath, 'F'); $output['pdfPath'] = $pdfPath; $output['pdfURI'] = $pdfPathURI; return $output; } exit; } else { return FALSE; } }
$statement->Cell(160); $statement->Cell(160, 06, 'Account NO: ' . $accno, 'R'); $statement->Ln(); $statement->Cell(10, 06, $town, 'L'); $statement->Cell(160); $statement->Cell(160, 06, 'Statement Date: ' . date("D,d-M-Y", time()), 'R'); $statement->Ln(); $statement->Cell(10, 06, 'Telephone. No: ' . $row_mem[2], 'L'); $statement->Cell(160); $statement->Cell(160, 06, 'NAV Date: ' . $navs[0], 'R'); $statement->Ln(); $statement->Cell(10, 06, 'Email Address: ' . $row_mem[4], 'L'); $statement->Ln(); $statement->Cell(200, 5, "********************************************************************************************************************************************"); /* * **********************Show the member transations******************************************************************* */ $statement->Ln(); $statement->SetFont('Arial', 'B', 9); $statement->Cell(200, 10, " DETAILS. PURCHASES. SALES. BALANCE."); $statement->SetFillColor(102, 51, 0); $statement->SetTextColor(252, 252, 252); $statement->setFont("Arial", "B", "9"); $statement->setXY(10, 100); $statement->Cell(15, 10, "R NO:", 1, 0, "L", 1); // header fields $statement->Cell(20, 10, "T DATE:", 1, 0, "L", 1); $statement->Cell(25, 10, "UNITS:", 1, 0, "L", 1); $statement->Cell(20, 10, "PRICE", 1, 0, "L", 1); $statement->Cell(35, 10, "COST:", 1, 0, "L", 1); $statement->Cell(25, 10, "UNITS:", 1, 0, "L", 1); $statement->Cell(25, 10, "PRICE", 1, 0, "L", 1); $statement->Cell(25, 10, "COST:", 1, 0, "L", 1);
$pdf->SetFont('Arial', 'B', 16); $pdf->Cell(50, 20, ''); $str = utf8_decode('ESRC - ESCOLA SUPERIOR DE TECNOLOGIA E EDUCAÇÃO DE RIO CLARO'); $pdf->Cell(0, 20, $str, 0, 0, 'C'); $pdf->SetFont('Arial', 'B', 14); $str = utf8_decode('ASSER - ASSOCIAÇÃO DAS ESCOLAS REUNIDAS'); $pdf->Cell(-140, 40, $str, 0, 1, 'C'); //certificado $pdf->SetFont('arial', 'B', 34); $pdf->Cell(0, 30, "CERTIFICADO", 0, 1, 'C'); //certificamos $pdf->SetFont('arial', 'B', 14); $pdf->Cell(0, 20, "Certificamos que " . utf8_decode($nome) . ",", 0, 1, 'C'); //texto $str = utf8_decode('Participou da IX - Semana Conhecimento e VI - Mostra de Iniciação Científica 2015 das Faculdades ASSER - Rio Claro, realizada no período de 14 a 18 de dezembro, como ouvinte totalizando ' . $total . ' horas.'); $pdf->setFont('arial', '', 14); $pdf->MultiCell(0, 10, $str, 0, 'J'); $pdf->Cell(0, 5, "", 0, 1, 'C'); $pdf->Cell(0, 10, "Rio Claro, 18 de dezembro de 2015.", 0, 1, 'C'); $pdf->Cell(0, 10, "_______________________________", 0, 1, 'C'); $pdf->Cell(0, 5, "Prof. Dr. Artur Darezzo Filho", 0, 1, 'C'); $pdf->Cell(0, 5, "Diretor da ESRC/ASSER", 0, 1, 'C'); $pdf->Image('logo.png', 250, 170, -300); $pdf->AddPage(); $pdf->setFont('arial', 'B', 14); $str = utf8_decode('Programação IX - Semana Conhecimento e VI - Mostra de Iniciação Científica - 2015'); $pdf->Cell(0, 20, $str, 0, 1, 'C'); $pdf->setFont('arial', '', 11); try { $ppalestra = "SELECT palestra FROM palestras WHERE pago='1' AND ra='{$ra}' AND presenca=1 order by palestra"; foreach ($link->query($ppalestra) as $row) {
$pdf->SetRightMargin($val[0]); break; case "SetTopMargin": $pdf->SetTopMargin($val[0]); break; case "MultiCell": $pdf->MultiCell($val[0], $val[1], $val[2], $val[3], $val[4]); break; case "SetXY": $pdf->SetXY($val[0], $val[1]); break; case "Rect": $pdf->Rect($val[0], $val[1], $val[2], $val[3]); break; case "setFont": $pdf->setFont($val[0], $val[1], $val[2]); break; case "Text": $pdf->Text($val[0], $val[1], $val[2]); break; } } foreach ($bottom as $val) { switch ($val["type"]) { case "MultiCell": $pdf->MultiCell($val[0], $val[1], $val[2], $val[3], $val[4]); break; case "Rect": $pdf->Rect($val[0], $val[1], $val[2], $val[3]); break; case "setFont":
function genCarpentras2() { global $options; # paramètres $mg = 3; // Marge de gauche => initial 17 $mh = 13; // Marge du haut => initial 9 $md = 0; // Marge de droite $mb = 11; // Marge du bas $largeur_etiquette = 70; // largeur_etiquette => initial 60 $espace_etiquettes = 0; // => initial 7 $nb_ligne_etiquettes = 11; $nb_etiquette_ligne = 3; $hauteur_etiquette = 25; // Préparation du document PDF. $pdf = new FPDF('P', 'mm', 'A4'); $pdf->Open(); $pdf->SetLeftMargin($mg); $pdf->SetTopMargin($mh); $pdf->SetAutoPageBreak(1, 0); $pdf->AddPage(); // Gestion des fonts $pdf->AddFont('code39', '', 'IDAutomation_Code_39.php'); $pdf->SetFont('times', '', 12); // Préparation des informations. $nom = strtoupper($this->patient->getNom()); $prenom = strtoupper($this->patient->getPrenom()); $date = new clDate($this->patient->getDateNaissance()); $dateN = $date->getDate("d/m/Y"); if ($this->patient->getSexe() == "F") { $sexe = "F"; $e = "e"; } elseif ($this->patient->getSexe() == "M") { $sexe = "M"; $e = ""; } else { $sexe = "Ind."; $e = ""; } $date->setDate($this->patient->getDateAdmission()); $led = $date->getDate("d/m/Y"); $ipp = $this->patient->getILP(); $nsej = $this->patient->getNSej(); $uf = $this->patient->getUF(); for ($i = 0; $i < $nb_ligne_etiquettes; $i++) { for ($j = 0; $j < $nb_etiquette_ligne; $j++) { $l = $j * $largeur_etiquette + $mg; $h = $i * $hauteur_etiquette + $mh; $le = $largeur_etiquette - $mg; $pdf->setY($h); $pdf->setX($l); $pdf->setFont('times', '', 9); $pdf->Cell($le, 4, "Dossier : ", 0, 0, L); $pdf->setY($h); $pdf->setX($l + 17); $pdf->setFont('times', 'b', 9); $pdf->cell($le - 10, 4, $nsej, 0, 0, L); //$pdf->setFont('times', '', 9 ) ; $pdf->setY($h); $pdf->setX($l); $pdf->cell($le - 10, 4, "U", 0, 0, R); $pdf->setY($h + 4); $pdf->setX($l); $pdf->setFont('times', '', 9); $pdf->cell($le, 4, $nom . " " . $prenom, 0, 0, L); $pdf->setY($h + 9); $pdf->setX($l); $pdf->cell($le, 4, "Né{$e} le : {$dateN}", 0, 0, L); $pdf->setY($h + 9); $pdf->setX($l); $pdf->cell($le - 10, 4, "Sexe : {$sexe}", 0, 0, R); $pdf->setY($h + 13); $pdf->setX($l); $pdf->cell($le, 4, "Le : {$led}", 0, 0, L); $pdf->setY($h + 13); $pdf->setX($l); $pdf->cell($le - 10, 4, "UF : {$uf}", 0, 0, R); $pdf->setY($h + 17); $pdf->setX($l); $pdf->cell($le - 10, 4, "NIP : {$ipp}", 0, 0, L); } } $pdf->Output(); }
$pdf->Cell(10, 5, '', 1, 0, "C"); $pdf->Cell(15, 5, 'NATA', 0, 1, "C"); } $pdf->Cell(1, 1, '', 0, 1, "C"); $pdf->Cell(210, 4, '', 0, 1, "C"); $pdf->SetFont('Arial', '', 12); $pdf->SetTextColor(0, 0, 0); $pdf->Cell(80, 0, '', 0, 0, "C"); if (strtoupper($course) == "INTERIOR DESIGN") { $pdf->Cell(10, 5, $pdf->Image($image12, $pdf->GetX(), $pdf->GetY(), 10, 5), 1, 0, 'L', false); $pdf->Cell(41, 5, 'INTERIOR DESIGN', 0, 1, "C"); } else { $pdf->Cell(10, 5, '', 1, 0, "C"); $pdf->Cell(41, 5, 'INTERIOR DESIGN', 0, 1, "C"); } $pdf->setFont('Arial', '', 12); $pdf->Cell(20, 15, 'Surname', 0, 0, "L"); $pdf->setFont('Arial', '', 12); $pdf->Cell(10, 0, '', 0, 0, "C"); $pdf->Cell(40, 15, $surname, 0, 1, "L"); $pdf->SetFillColor(150, 150, 150); $pdf->Rect(40, 90, 114, 0.5, 'F'); $pdf->setFont('Arial', '', 12); $pdf->Cell(20, 5, 'Firstname', 0, 0, "L"); $pdf->setFont('Arial', '', 12); $pdf->Cell(10, 0, '', 0, 0, "C"); $pdf->Cell(40, 5, $firstname, 0, 1, "L"); $pdf->SetFillColor(150, 150, 150); $pdf->Rect(40, 100, 114, 0.5, 'F'); // Explora icon $pdf->setXY(160, 61);
<?php define('FPDF_FONTPATH', '.'); require '../../fpdf.php'; $pdf = new FPDF(); $pdf->addFont('Calligrapher', '', 'calligra.php'); $pdf->addPage(); $pdf->setFont('Calligrapher', '', 35); $pdf->cell(0, 10, 'Enjoy new fonts with FPDF!'); $pdf->output();
} else { $pdf = new FPDF('L'); $pdf->AddPage(); $pdf->Image('logo1.png', 10, 10, -450); $pdf->SetFont('times', 'B', 16); $pdf->Cell(50, 20, ''); $str = utf8_decode('ESRC - ESCOLA SUPERIOR DE TECNOLOGIA E EDUCAÇÃO DE RIO CLARO'); $pdf->Cell(0, 20, $str, 0, 0, 'C'); $pdf->SetFont('times', 'B', 14); $str = utf8_decode('ASSER - ASSOCIAÇÃO DAS ESCOLAS REUNIDAS'); $pdf->Cell(-140, 40, $str, 0, 1, 'C'); //certificado $pdf->SetFont('times', 'B', 34); $pdf->Cell(0, 30, "CERTIFICADO", 0, 1, 'C'); //certificamos $pdf->SetFont('times', 'B', 14); $pdf->Cell(0, 20, "Certificamos que " . $session->get('nome') . ",", 0, 1, 'C'); //texto $str = 'Participou da VII - Mostra de Iniciação Científica 2016 das Faculdades ASSER - Rio Claro, realizada no período de 30 de maio a 01 de juno, com apresentação ' . $tipo . ' do trabalho intitulado ' . $titulo . '.'; $pdf->setFont('times', '', 12); $pdf->MultiCell(0, 10, $str, 0, 'J'); $pdf->Cell(0, 10, "", 0, 1, 'C'); $pdf->Cell(0, 10, "Rio Claro, 05 de junho de 2016.", 0, 1, 'C'); $pdf->Cell(0, 10, "_______________________________", 0, 1, 'C'); $pdf->Cell(0, 5, "Prof. Dr. Artur Darezzo Filho", 0, 1, 'C'); $pdf->Cell(0, 5, "Diretor da ESRC/ASSER", 0, 1, 'C'); $pdf->Image('logo.png', 250, 170, -300); ob_clean(); $pdf->Output("Certificado.pdf", "D"); }
define('FPDF_FONTPATH', 'font'); require 'fpdf.php'; include "../connection/dbConnect.php"; $sql = "SELECT * FROM tbl_participants ORDER BY id ASC"; $smt = $con->query($sql); $numOfRows = $smt->rowCount(); $query = $con->prepare($sql); $query->execute(); $pdf = new FPDF('P', 'pt', 'Letter'); $pdf->SetFont('Times'); $pdf->AddPage('L'); $pdf->SetAutoPageBreak(false); $pdf->SetFillColor(170, 170, 170); //gray $pdf->setFont("times", "B", "12"); $pdf->setXY(40, 40); $pdf->Cell(25, 20, "#", 1, 0, "C", 1); $pdf->Cell(140, 20, "Last Name", 1, 0, "C", 1); $pdf->Cell(140, 20, "First Name", 1, 0, "C", 1); $pdf->Cell(140, 20, "Middle Name", 1, 0, "C", 1); $pdf->Cell(120, 20, "Contact Number", 1, 0, "C", 1); $pdf->Cell(160, 20, "e-mail", 1, 0, "C", 1); $y = 60; $x = 40; $pdf->setXY($x, $y); $z = 0; while ($row = $query->fetch()) { $pdf->Cell(25, 20, $z += 1, 1); $pdf->Cell(140, 20, iconv('UTF-8', 'windows-1252', $row[3]), 1); $pdf->Cell(140, 20, iconv('UTF-8', 'windows-1252', $row[1]), 1);
} else { if ($res[0]['skor'] <= 129 && $res[0]['skor'] >= 115) { $tingkat = 'Tinggi dalam kategori normal'; } else { if ($res[0]['skor'] <= 139 && $res[0]['skor'] >= 130) { $tingkat = 'Superior'; } else { $tingkat = 'Jenius'; } } } } } if ($res[0]['id'] != $user) { echo '<script>document.location="index.php"</script>'; } $pdf = new FPDF('L', 'cm', 'A4'); $pdf->Open(); $pdf->addPage(); $pdf->setAutoPageBreak(false); $pdf->setFont('Times', '', 17); $pdf->Image('sertifikatku.jpg', 0, 0, 29.7, 21); $pdf->Text(20.5, 5.84, '' . $kategori . ''); $pdf->setFont('Times', 'B', 20); $pdf->text(14.2, 12, '' . $res[0]['skor'] . '', 'C'); $pdf->Cell(0, 25.5, '' . $tingkat . '', 0, 0, 'C', 0, 0); $pdf->setFont('Times', 'B', 36); $pdf->Cell(-28, 15.4, '' . $nama . '', 0, 0, 'C', 0, 0); $pdf->setFont('Times', 'B', 14); $pdf->text(7.58, 2.818, '' . $tgl . '/' . $nomor . '', 'C'); $pdf->output();
$pdf->Cell(10); $pdf->Cell(10, 06, 'Email : ' . $supervisor_details->emailAddress); $pdf->Cell(110); $pdf->Cell(110, 05, 'Email: ' . $supervisor_details->memail, 'R'); $pdf->Ln(); $pdf->Cell(130); $pdf->Cell(120, 05, 'Zone: ' . $supervisor_details->zoneName, 'R'); $pdf->Ln(); /*********************************display zones******************************************************/ $pdf->Ln(); $pdf->SetX(10); $pdf->SetFont('times', 'B', 12); $pdf->Cell(200, 10, " Technician Details. Station . Site."); $pdf->SetFillColor(255, 140, 0); $pdf->SetTextColor(255, 255, 255); $pdf->setFont("times", "B", 9); $pdf->Ln(); $pdf->setXY(10, 65); $pdf->Cell(20, 10, "NO:", 1, 0, "L", 1); // header fields $pdf->Cell(35, 10, "TECHNICIAN NAME:", 1, 0, "L", 1); $pdf->Cell(25, 10, "CONTACT NO", 1, 0, "L", 1); $pdf->Cell(35, 10, "EMAIL ADDRESS", 1, 0, "L", 1); $pdf->Cell(40, 10, "STATION NAME:", 1, 0, "L", 1); $pdf->Cell(40, 10, "SITE NAME:", 1, 0, "L", 1); $y = 75; $x = 10; $pdf->setXY($x, $y); if (is_array($techDetails)) { foreach ($techDetails as $tech) { $pdf->SetFont('times', '', '9');
<?php include "../config/config.php"; include "../pdf/fpdf/fpdf.php"; //include "../barcode/barcode.php"; //include "../barcode/bars.php"; $pdf = new FPDF(); $pdf->Open(); $pdf->addPage(); $pdf->setAutoPageBreak(true); $pdf->setFont('Arial', '', 12); $pdf->text(10, 25, 'Tes User DB'); $pdf->Line(10, 31, 198, 31); $yi = 50; $ya = 44; $pdf->setFont('Arial', '', 9); $pdf->setFillColor(222, 222, 222); $pdf->setXY(10, $ya); $pdf->CELL(6, 6, 'ID', 1, 0, 'C', 1); $pdf->CELL(40, 6, 'Username', 1, 0, 'C', 1); $pdf->CELL(50, 6, 'Password', 1, 0, 'C', 1); $ya = $yi + $row; $sql = "SELECT id, password, username FROM user"; $result = $conn->query($sql); $i = 1; $no = 1; $max = 31; //$row = 6; if ($result->num_rows > 0) { while ($row = $result->fetch_assoc()) { $pdf->setXY(10, $ya);
public function download() { define('FPDF_FONTPATH', APPPATH . 'plugins/fpdf/font/'); require APPPATH . 'plugins/fpdf/fpdf.php'; $this->load->helper('url'); $getmed = $this->dbroom->getmedical(); $getlau = $this->dbroom->getlaundry(); $data['mednil'] = 0; $data['launil'] = 0; if ($getmed->num_rows() == 0) { $data['mednil'] = 1; } if ($getlau->num_rows() == 0) { $data['launil'] = 1; } $pdf = new FPDF('p', 'mm', 'a4'); $pdf->AddPage(); $pdf->setDisplayMode('fullpage'); $pdf->setFont('times', 'B', '20'); if (!$data['mednil']) { $pdf->write(10, "\nStudents Asked for Medical Help\n\n"); $pdf->setFont('times', 'B', '15'); $pdf->cell(80, 10, "Name", 1, 0, 'C'); $pdf->cell(40, 10, "Room", 1, 0, 'C'); $pdf->cell(40, 10, "Phone", 1, 0, 'C'); $pdf->write(10, "\n"); foreach ($getmed->result() as $row) { $pdf->setFont('times', '', '15'); $pdf->cell(80, 10, $row->name, 1, 0, 'C'); $pdf->cell(40, 10, $row->room, 1, 0, 'C'); $pdf->cell(40, 10, $row->phone, 1, 0, 'C'); $pdf->write(10, "\n"); // $pdf -> cell(200,30,$row->room,1,1); // $pdf -> cell(200,30,$row->phone,1,1); } } $pdf->setFont('times', 'B', '20'); if (!$data['launil']) { $pdf->write(10, "\nStudents Asked for Laundry Service\n\n"); $pdf->setFont('times', 'B', '15'); $pdf->cell(80, 10, "Name", 1, 0, 'C'); $pdf->cell(40, 10, "Room", 1, 0, 'C'); $pdf->cell(40, 10, "Phone", 1, 0, 'C'); $pdf->write(10, "\n"); foreach ($getlau->result() as $row) { $pdf->setFont('times', '', '15'); $pdf->cell(80, 10, $row->name, 1, 0, 'C'); $pdf->cell(40, 10, $row->room, 1, 0, 'C'); $pdf->cell(40, 10, $row->phone, 1, 0, 'C'); $pdf->write(10, "\n"); // $pdf -> cell(200,30,$row->room,1,1); // $pdf -> cell(200,30,$row->phone,1,1); } } $pdf->output('service.pdf', 'D'); }