function loadPage() { // create new PDF document $pdf = new MYPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); $pdf->titulo = $this->getPlan(); // set document information $pdf->SetCreator(PDF_CREATOR); $pdf->SetAuthor('Red de Universidades Anahuac'); $pdf->SetTitle('Plan Estrategico'); $pdf->SetSubject($this->getPlan()); $pdf->SetKeywords('TCPDF, PDF, example, test, guide'); // set default header data $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING); // set header and footer fonts $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); // set default monospaced font $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); //set margins $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); $pdf->SetHeaderMargin(PDF_MARGIN_HEADER); $pdf->SetFooterMargin(PDF_MARGIN_FOOTER); //set auto page breaks $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); //set image scale factor $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); //set some language-dependent strings //$pdf->setLanguageArray($l); // --------------------------------------------------------- // set font $pdf->SetFont('helvetica', 'N', 11); // add a page $pdf->AddPage(); $pdf->SetY(5); $html = "\n<!-- EXAMPLE OF CSS STYLE -->\n<style> \n\ttd{\n\tborder:1px solid #666;\n\t}\n\t\n\ttd.title{\n\tbackground:#E5E5E5;\n\tpadding:10px;\n\t}\n \n</style> <br />"; $html .= $this->Model->getLineas(); // output the HTML content $pdf->writeHTML($html, true, false, true, false, ''); //Close and output PDF document $pdf->Output('plan_operativo.pdf', 'I'); }
$RM = $pdf->getMargins()['right']; $W = $pdf->getPageWidth() - $RM - $LM; // --------------------------------------------------------- $pdf->SetFont('helvetica', '', 12); $pdf->AddPage(); // Print address $pdf->SetFont('helvetica', '', 10); foreach ($REC_ADRESS as $line) { $pdf->Cell(0, 0, $line, 0, 1); } $pdf->SetFont('helvetica', '', 8); $pdf->ln(); $pdf->Cell(0, 0, $SPECIAL_NOTE, 0, 1); $pdf->ln(); // --------------------------------------------------------- $pdf->SetY(90); $pdf->SetFont('helvetica', '', 12); $pdf->Image($HEADER_IMG, $pdf->GetX(), $pdf->GetY(), $W, '', 'png', '', 'T', true, 300, '', false, false, 0, true, false, false); $pdf->SetY(120); $pdf->SetFont('helvetica', 'B', 14); $pdf->Cell(0, 0, "Letter of Attendance", 0, 1); $pdf->SetY(140); $pdf->SetFont('helvetica', '', 12); $pdf->writeHTML($HTML, true, false, true, false, ''); $SIGPOS = 200; $SIGOFF = 20; $pdf->SetY($SIGPOS); $pdf->SetFont('helvetica', '', 12); $pdf->Cell(0, 0, "Sincerely,", 0, 1); $pdf->SetY($SIGPOS + 30); $pdf->Cell(0, 0, $SIGNATURE_IMGPERS[0], 0, 1);
$pdf->setLanguageArray($l); $pdf->SetFont('times', '', 10, '', true); $pdf->AddPage(); $spacing = -0.01; $stretching = 75; $pdf->setFontStretching($stretching); $pdf->setFontSpacing($spacing); $titling = <<<EOD <strong> <font style="font-size:11">Pharmacy Sys</font> </strong> <br> <strong>Official Receipt</strong><br> Student Center Ground Floor,<br> P.O. Box Private Bag Kabarak, Kenya <br> Tel: +254 702 937 925 <br> E-mail: pharmacysys@yahoo.com <br>----------------------------------------- EOD; $header = array('Drug', 'Price.', 'Qtty', 'Cost(Kshs.)'); $ddt = <<<EOD {$time} EOD; $html = <<<EOD <br>----------------------------------------- EOD; $data = $pdf->LoadData('receipts/docs/' . $recNo . '.txt'); $pdf->writeHTMLCell($w = 0, $h = 0, $x = '', $y = '', $titling, $border = 0, $ln = 1, $fill = 0, $reseth = true, $align = 'C', $autopadding = true); $pdf->writeHTMLCell($w = 0, $h = 0, $x = '', $y = '', $ddt, $border = 0, $ln = 1, $fill = 0, $reseth = true, $align = 'L', $autopadding = true); $pdf->writeHTMLCell($w = 0, $h = 0, $x = '', $y = '', $html, $border = 0, $ln = 1, $fill = 0, $reseth = true, $align = '', $autopadding = true); $pdf->ColoredTable($header, $data); $pdf->SetY(-10); $pdf->Cell(0, 0, 'You were served by: ' . strtoupper($user), 0, false, 'L', 0, '', 0, false, 'T', 'M'); $pdf->Output('receipts/printouts/' . $details1['customer_name'] . '-receipt.pdf', 'F'); unlink('receipts/docs/' . $recNo . '.txt'); unset($_SESSION['custId'], $_SESSION['custName'], $_SESSION['age'], $_SESSION['sex'], $_SESSION['postal_address'], $_SESSION['phone']); header('Location: payment.php'); exit;
// start of creating the documents while ($meineSchueler = mysql_fetch_assoc($meineSchueler_tmp)) { $schueler_uid = $meineSchueler['usr_id']; $schueler_vorname = $meineSchueler['firstname']; $schueler_nachname = $meineSchueler['lastname']; $pdf->SetFont('times', '', 14); $pdf->setPrintHeader(true); // add a page $pdf->AddPage('P', 'A4'); //personenbezogene Kopfdaten $pdf->SetXY(20, 42); $pdf->Cell(45, 5, $schueler_nachname . ', ' . $schueler_vorname, 0, 0, 'L', 0, '', 0, false, 'C', 'C'); $pdf->Cell(0, 5, $klassenbezeichner . ': ' . $kl, 0, 1, 'R', 0, '', 0, false, 'C', 'C'); $pdf->Line(20, 47, 195, 47, $style2); $pdf->SetFont('helvetica', '', 14); $pdf->SetY(52); $pdf->SetFont('helvetica', 'B', 14); $pdf->MultiCell(0, 2, '', 0, 'L', 0, 1, '', '', true); //als verticaler Abstand, mir fiel grad nichts besseres ein $pdf->Cell(45, 5, 'Deine Lernziele im ' . $_SESSION['aktueller_term_name'], 0, 1, 'L', 0, '', 0, false, 'C', 'C'); $pdf->MultiCell(0, 1, '', 0, 'L', 0, 1, '', '', true); //als verticaler Abstand, mir fiel grad nichts besseres ein //Ausdrucken von Lernziel 1 und 2 $lz1_tmp = mysql_query("SELECT * FROM lernstand.lernziele WHERE uid = '" . $schueler_uid . "' AND lz_nr = '1' AND term = '" . $_SESSION['aktueller_term_nr'] . "'"); $lz2_tmp = mysql_query("SELECT * FROM lernstand.lernziele WHERE uid = '" . $schueler_uid . "' AND lz_nr = '2' AND term = '" . $_SESSION['aktueller_term_nr'] . "'"); $lz1 = ''; $lz2 = ''; if (mysql_num_rows($lz1_tmp) > 0) { $lz1 = mysql_result($lz1_tmp, '0', 'lz_text'); } if (mysql_num_rows($lz2_tmp) > 0) {
$this->SetY(-15); //Arial italic 8 $this->SetFont('DejaVu Sans B', 'I', 8); //Text color in gray $this->SetTextColor(128); //Page number $this->Cell(0, 10, 'Stranica ' . $this->PageNo(), 0, 0, 'C'); } } } // Prva stranica $pdf = new MYPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); $pdf->AddFont("DejaVuSans", "", "DejaVuSans.php"); $pdf->AddFont("DejaVuSans", "", "DejaVuSans-Bold.php"); $pdf->AddPage(); $pdf->SetY(100); $pdf->SetFont('DejaVuSans', '', 30); $pdf->Cell(190, 10, $imezad, 0, 0, 'C'); $pdf->Ln(); $pdf->SetFont('DejaVuSans', '', 16); $pdf->Cell(190, 10, $imepredmeta, 0, 0, 'C'); $pdf->SetY(-90); $pdf->SetFont('DejaVu Sans', '', 12); $pdf->Cell(40, 10, 'Student:'); $pdf->SetFont('DejaVu Sans B', '', 12); $pdf->Cell(24, 10, $ime . ' ' . $prezime, 0, 0, 'C'); $pdf->Ln(); if ($labgrupa != "") { $pdf->SetFont('DejaVu Sans', '', 12); $pdf->Cell(40, 10, 'Grupa:'); $pdf->SetFont('DejaVu Sans', '', 12);
//set margins $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); $pdf->SetHeaderMargin(PDF_MARGIN_HEADER); $pdf->SetFooterMargin(PDF_MARGIN_FOOTER); //set auto page breaks $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); //set image scale factor $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); //set some language-dependent strings //$pdf->setLanguageArray($l); // --------------------------------------------------------- $pdf->SetFont('times', 'B', 17); // add a page $pdf->AddPage(); $pdf->SetTextColor(190); $pdf->SetY(5); $pdf->Write(10, 'Facture ' . $id_ventes . ' ', '', 0, 'R', true); /*écriture "ACQUITTEE" if ($donnees['paiement']==1){ $pdf->SetFont('times', '', 49); $pdf->SetY(10); $pdf->SetTextColor(250,0,0); $pdf->Write(10, 'ACQUITTE','',0, 'R',true); } */ $pdf->SetFont('times', '', 9); $pdf->SetY(30); $pdf->SetTextColor(0); // set columns width $first_column_width = 100; $second_column_width = 60;
x="155" y="110" width="11" height="5" stroke-width="0.000001" fill-opacity="0.000001" visibility="visible" style="cursor:pointer;"></rect><rect rx="0" ry="0" fill="rgb(192,192,192)" x="203" y="88" width="11" height="27" stroke-width="0.000001" fill-opacity="0.000001" visibility="visible" style="cursor:pointer;"></rect><rect rx="0" ry="0" fill="rgb(192,192,192)" x="251" y="106" width="11" height="9" stroke-width="0.000001" fill-opacity="0.000001" visibility="visible" style="cursor:pointer;"></rect><rect rx="0" ry="0" fill="rgb(192,192,192)" x="25" y="113" width="11" height="2" stroke-width="0.000001" fill-opacity="0.000001" visibility="visible" style="cursor:pointer;"></rect><rect rx="0" ry="0" fill="rgb(192,192,192)" x="73" y="98" width="11" height="17" stroke-width="0.000001" fill-opacity="0.000001" visibility="visible" style="cursor:pointer;"></rect><rect rx="0" ry="0" fill="rgb(192,192,192)" x="121" y="81" width="11" height="34" stroke-width="0.000001" fill-opacity="0.000001" visibility="visible" style="cursor:pointer;"></rect><rect rx="0" ry="0" fill="rgb(192,192,192)" x="169" y="112" width="11" height="3" stroke-width="0.000001" fill-opacity="0.000001" visibility="visible" style="cursor:pointer;"></rect><rect rx="0" ry="0" fill="rgb(192,192,192)" x="217" y="110" width="11" height="5" stroke-width="0.000001" fill-opacity="0.000001" visibility="visible" style="cursor:pointer;"></rect><rect rx="0" ry="0" fill="rgb(192,192,192)" x="265" y="106" width="11" height="9" stroke-width="0.000001" fill-opacity="0.000001" visibility="visible" style="cursor:pointer;"></rect></g></svg> EOD; $pdf->ImageSVG($file = '@' . $svg, $x = 10, $y = 25, $w = 200, $h = 100, $link = '', $align = '', $palign = '', $border = 0, $fitonpage = false); $tbl = <<<EOD <table report="9080" id="dataTable_9080" class="simpleTable sticky-enabled" width="100%" border="1" cellspacing="0" cellpadding="0"> <thead><tr><th><div class="advTableHeaderVal" column="attr:c_name.c_name.value">Name</div></th><th><div class="advTableHeaderVal" column="measure:c_amount__avg">Amount (AVG)</div></th> </tr></thead> <tbody> <tr class="odd"><td>Glo</td><td>35</td> </tr> <tr class="even"><td>Flo</td><td>222</td> </tr> <tr class="odd"><td>Jim</td><td>452</td> </tr> <tr class="even"><td>Moe</td><td>49</td> </tr> <tr class="odd"><td>Joe</td><td>68</td> </tr> <tr class="even"><td>Hello</td><td>123</td> </tr> </tbody> </table> EOD; $pdf->SetY(150); $pdf->writeHTML($tbl, true, false, false, false, ''); // --------------------------------------------------------- //Close and output PDF document $pdf->Output('example_058.pdf', 'I'); //============================================================+ // END OF FILE //============================================================+
// set margins $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); $pdf->SetHeaderMargin(10); // set auto page breaks $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); // set image scale factor $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); // set default font subsetting mode $pdf->setFontSubsetting(true); // Set font $pdf->SetFont('helvetica', '', 14, '', true); // Add a page // This method has several options, check the source code documentation for more information. $pdf->AddPage(); $indexes = getIndexes(); $pdf->SetY(50); // column titles $header = array('MES', '$/m²', 'ÍNDICE', 'VARIACIÓN'); // data loading $data = $pdf->LoadData($indexes); // print colored table $pdf->ColoredTable($header, $data); $pdf->Output('indice-general-de-la-construcción.pdf', 'I'); break; case '4': // create new PDF document $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); // set default header data $pdf->SetHeaderData('logo.png', 15, "APYMECO", "Índice general de la construcción", array(0, 0, 0), array(0, 0, 0)); // set header and footer fonts $pdf->setHeaderFont(array('helvetica', '', 12));
$LM = $pdf->getMargins()['left']; $RM = $pdf->getMargins()['right']; $W = $pdf->getPageWidth() - $RM - $LM; // --------------------------------------------------------- $pdf->SetFont('helvetica', '', 12); $pdf->AddPage(); // Print address $pdf->SetFont('helvetica', '', 10); foreach ($REC_ADRESS as $line) { $pdf->Cell(0, 0, $line, 0, 1); } $pdf->SetFont('helvetica', '', 8); $pdf->ln(); $pdf->Cell(0, 0, $SPECIAL_NOTE, 0, 1); $pdf->ln(); $pdf->SetY(90); $pdf->SetFont('helvetica', 'B', 14); $pdf->Cell(0, 0, "Invoice", 0, 1); // --------------------------------------------------------- $pdf->SetY(100); $pdf->SetFont('helvetica', '', 12); $pdf->Image($HEADER_IMG, $pdf->GetX(), $pdf->GetY(), $W, '', 'png', '', 'T', true, 300, '', false, false, 0, true, false, false); $w2 = 20; $pdf->SetY(140); foreach ($INVOICE_ITMS as $i) { $item = $i[0]; $curr = $i[1]; $amnt = $i[2]; $pdf->Cell($W - 2 * $w2, 0, $item, "B", 0); $pdf->Cell($w2, 0, $curr, "B", 0, "R"); $pdf->Cell($w2, 0, $amnt, "B", 1, "R");
* You can load external XHTML using : * * $html = file_get_contents('/path/to/your/file.html'); * * External CSS files will be automatically loaded. * Sometimes you need to fix the path of the external CSS. * ********************************************************* */ // define some HTML content with style $html = <<<EOF eoe.cn EOF; $html = file_get_contents("http://wiki.eoe.git/show/html/slug/Creating_an_Android_Project"); // echo $html; // die; $pdf->SetY(15); // output the HTML content // $pdf->writeHTML($html, true, false, true, false, ''); $pdf->writeHTMLCell($w = 0, $h = 0, $x = '', $y = '', $html, $border = 0, $ln = 1, $fill = 0, $reseth = true, $align = '', $autopadding = true); // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // ******************************************************************* // HTML TIPS & TRICKS // ******************************************************************* // REMOVE CELL PADDING // $pdf->SetCellPadding(0); // // This is used to remove any additional vertical space inside a // single cell of text. // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // REMOVE TAG TOP AND BOTTOM MARGINS
} if ($whratio >= 1 || $imagewidth > $width + 1) { $imagewidth = $width - 1; // horizontal images are scaled to width - 1 in $hwratio = $imagesize[1] / $imagesize[0]; $imageheight = $imagewidth * $hwratio; } $pdf->Text(0.5, 0.5, i18n_get_translated($resourcedata['field' . $view_title_field]) . ' ' . $date); $pdf->Image($imgpath, ($width - 1) / 2 - ($imagewidth - 1) / 2, 1, $imagewidth, $imageheight, "jpg", $baseurl . '/?r=' . $ref); // set color for background $pdf->SetFillColor(255, 255, 200); $style = array('width' => 0.01, 'cap' => 'butt', 'join' => 'round', 'dash' => '0', 'color' => array(100, 100, 100)); $style1 = array('width' => 0.04, 'cap' => 'butt', 'join' => 'round', 'dash' => '0', 'color' => array(255, 255, 0)); $style2 = array('width' => 0.02, 'cap' => 'butt', 'join' => 'round', 'dash' => '3', 'color' => array(255, 0, 0)); $ypos = $imageheight + 1.5; $pdf->SetY($ypos); $m = 1; unset($notes); if ($resources[$n]['annotation_count'] != 0) { $notes = sql_query("select * from annotate_notes where ref='{$ref}'"); foreach ($notes as $note) { $ratio = $imagewidth / $note['preview_width']; $note_y = $note['top_pos'] * $ratio; $note_x = $note['left_pos'] * $ratio; $note_width = $note['width'] * $ratio; $note_height = $note['height'] * $ratio; $pdf->SetLineStyle($style1); $pdf->Rect(($width - 1) / 2 - ($imagewidth - 1) / 2 + $note_x, $note_y + 1, $note_width, $note_height); $pdf->Rect(($width - 1) / 2 - ($imagewidth - 1) / 2 + $note_x, $note_y + 1, 0.1, 0.1, 'DF', $style1, array(255, 255, 0)); $ypos = $pdf->GetY(); $pdf->Text(($width - 1) / 2 - ($imagewidth - 1) / 2 + $note_x - 0.01, $note_y + 0.99, $m, false, false, true, 0, 0, 'L');
if(is_file('../../images/medie/'.$im['foto_g_immobile'])) { $pdf->WriteHTML('<table align="center" width="100%"><tr><td align="center" valign="middle"><img src="../images/medie/'.$im['foto_g_immobile'].'" /></td></tr></table>',false); } else { $pdf->WriteHTML('<table align="center" width="100%"><tr><td align="center" valign="middle"><img src="../images/medie/imagenotavailable_big.gif" /></td></tr></table>',false); } $pdf->SetFont($fontLan,'',10); //Pagina della descrizione * */ $pdf->AddPage(); $pdf->setPrintHeader(true); $pdf->SetFont($fontLan, 'B', 14); $pdf->SetY(5); $pdf->SetX(33); $pdf->Cell(145, 0, $titolo, 0, 2, 'C'); $pdf->SetY(10); if ($prezzo > 0) { $pdf->WriteHTML('<div align="center">€ ' . number_format($im['prezzo'], 0, ',', '.') . '</div>', false); } if ($im['foto_g_immobile'] != '') { $pdf->Image(IMAGESPATH . 'medie/' . $im['foto_g_immobile'], 13, 15, 0, 80, '', '', 'C'); } else { $pdf->Image(IMAGESPATH . 'medie/imagenotavailable_big.gif', 5, 17); } $pdf->SetY(100); $pdf->SetX(10); $pdf->SetFont($fontLan, '', 12); $pdf->WriteHTML('<table align="center" width="520"><tr><td align="left">' . stripslashes($im['descrizione_' . $lan]) . '</td></tr></table>', false);
} else { $pdf->Cell($cellsize[0], $cellsize[1], '', 0, 0); } } $n = $n++; if ($i == $columns) { $pdf->ln(); $i = 0; $j++; if ($j > $rowsperpage) { $j = 0; if ($n < count($result) - 1) { //avoid making an additional page if it will be empty $pdf->AddPage(); $pdf->SetX(1); $pdf->SetY(1.2); } } } } } } #Make AJAX preview?: if ($preview == true && isset($imagemagick_path)) { if (file_exists(get_temp_dir() . "/contactsheetrip.jpg")) { unlink(get_temp_dir() . "/contactsheetrip.jpg"); } if (file_exists(get_temp_dir() . "/contactsheet.jpg")) { unlink(get_temp_dir() . "/contactsheet.jpg"); } if (file_exists(get_temp_dir() . "/contactsheet.pdf")) {
$pdf->StartTransform(); $pdf->Rotate(90); $pdf->Cell(15, 5, 'Schüler', 1, 2, 'C', 0, '', 0, false, 'M', 'M'); $fach[] = array(); while ($item = mysql_fetch_array($faecherTableHeader)) { $fach[] = $item[0]; } for ($a = 1; $a <= $fachAnzahl; $a++) { $pdf->Cell(15, 5, $fach[$a], 1, 2, 'C', 0, '', 3, false, 'T', 'C'); } //reset(mysql_fetch_assoc($faecherTableHeader)); $pdf->Cell(15, 5, 'Eltern', 1, 1, 'C', 0, '', 0, false, 'T', 'C'); $pdf->StopTransform(); $kompBreite = 100 + ($fachAnzahl + 2) * 5; $pdf->Ln(); $pdf->SetY(68); for ($k = 0; $k < $fragenAnzahl; $k++) { //$punkte = mysql_query("SELECT * FROM bewertung WHERE uid = '".$uid[$i]."' AND frage = '".$frageNr[$k]."'"); //erste Kompetenz $pdf->SetX(20); $pdf->SetFont('helvetica', 'b', '9'); if ($k == 0) { $pdf->MultiCell($kompBreite, 5, 'Sachkompetenz', 'LRT', 'L', 0, 1, '', '', true); } $pdf->SetFont('times', '', '9'); $pdf->SetX(20); //Erste Spalte mit Fragetexten if ($frageNr[$k] !== '39' && $frageNr[$k] !== '71' && $frageNr[$k] !== '77' && $frageNr[$k] !== '78') { $fragetextneu[$k] = 'Ich kann ' . $fragetext[$k]; } else { $fragetextneu[$k] = $fragetext[$k];