function student_kolizijapdf() { global $userid; require_once 'lib/tcpdf/tcpdf.php'; $semestar = intval($_REQUEST['semestar']); if ($semestar == 1) { $tekst_semestar = "zimskom"; } else { $tekst_semestar = "ljetnjem"; } // Prikupljam podatke iz baze // Za koju godinu se prijavljuje? $q1 = myquery("select id, naziv from akademska_godina where aktuelna=1"); $q2 = myquery("select id, naziv from akademska_godina where id>" . mysql_result($q1, 0, 0) . " order by id limit 1"); if (mysql_num_rows($q2) < 1) { // nicemessage("U ovom trenutku nije aktiviran upis u sljedeću akademsku godinu."); // return; // Pretpostavljamo da se upisuje u aktuelnu? $zagodinu = mysql_result($q1, 0, 0); $agnaziv = mysql_result($q1, 0, 1); $q3 = myquery("select id from akademska_godina where id<{$zagodinu} order by id desc limit 1"); $proslagodina = mysql_result($q3, 0, 0); } else { $proslagodina = mysql_result($q1, 0, 0); $zagodinu = mysql_result($q2, 0, 0); $agnaziv = mysql_result($q2, 0, 1); } // Koji je odsjek? $q4 = myquery("select s.id, s.naziv, i.naziv, ss.semestar from studij as s, student_studij as ss, institucija as i where ss.student={$userid} and ss.studij=s.id and s.institucija=i.id and ss.akademska_godina={$proslagodina} order by semestar desc limit 1"); if (mysql_num_rows($q4) < 1) { // Očito da su aktuelna i prošla godina loše određene $q4 = myquery("select s.id, s.naziv, i.naziv, ss.semestar, ss.akademska_godina from studij as s, student_studij as ss, institucija as i where ss.student={$userid} and ss.studij=s.id and s.institucija=i.id order by akademska_godina desc, semestar desc limit 1"); if (mysql_num_rows($q4) < 1) { biguglyerror("Nikada niste bili nas student!"); return; } $proslagodina = mysql_result($q4, 0, 4); if (mysql_num_rows($q2) < 1) { biguglyerror("Nije kreirana nova akademska godina u koju se upisujete."); print "Kontaktirajte administratora."; return; } $q2 = myquery("select id, naziv from akademska_godina where id>{$proslagodina} order by id limit 1"); $zagodinu = mysql_result($q2, 0, 0); $agnaziv = mysql_result($q2, 0, 1); } $studij = mysql_result($q4, 0, 0); $studij_naziv = mysql_result($q4, 0, 1); $institucija_naziv = mysql_result($q4, 0, 2); $godina_studija = ceil(mysql_result($q4, 0, 3) / 2); // Da li je student popunio ugovor za drugi odsjek? $tekst_mijenja = ""; $q7 = myquery("select s.id, s.naziv, i.naziv from studij as s, ugovoroucenju as uou, institucija as i where uou.student={$userid} and uou.studij=s.id and s.institucija=i.id and uou.akademska_godina={$zagodinu}"); if (mysql_num_rows($q7) > 1 && $studij != mysql_result($q7, 0, 0)) { $institucija_naziv = mysql_result($q7, 0, 2); $tekst_mijenja = "predao sam zahtjev za promjenu studija na " . mysql_result($q7, 0, 1) . ". S tim u vezi, "; } // Zapis u tabeli kolizija $predmeti_kolizija = $predmeti_ects = array(); $q10 = myquery("select p.id, p.naziv, p.ects from kolizija as k, predmet as p where k.student={$userid} and k.akademska_godina={$zagodinu} and k.semestar={$semestar} and k.predmet=p.id"); if (mysql_num_rows($q10) < 1) { biguglyerror("Vi niste popunili Zahtjev za koliziju za {$agnaziv} godinu!"); print "Ako je ovo greska, kontaktirajte administratora."; return; } while ($r10 = mysql_fetch_row($q10)) { $predmeti_kolizija[$r10[0]] = $r10[1]; $predmeti_ects[$r10[0]] = $r10[2]; } if ($semestar == 1) { $s2 = 1; } else { $s2 = 0; } // Predmeti koje nije polozio $predmeti_prenos = array(); $q20 = myquery("select p.id, p.naziv, p.ects from student_predmet as sp, ponudakursa as pk, predmet as p where sp.student={$userid} and sp.predmet=pk.id and pk.predmet=p.id and pk.akademska_godina={$proslagodina} and pk.semestar MOD 2={$s2} and pk.semestar<{$godina_studija}*2+1 and (select count(*) from konacna_ocjena as ko where ko.student={$userid} and ko.predmet=p.id and ko.ocjena != 5)=0"); while ($r20 = mysql_fetch_row($q20)) { if (array_key_exists($r20[0], $predmeti_kolizija)) { continue; } $predmeti_prenos[$r20[0]] = $r20[1]; $predmeti_ects[$r20[0]] = $r20[2]; } // Podaci o studentu $q30 = myquery("select ime, prezime, brindexa, spol from osoba where id={$userid}"); $ime = mysql_result($q30, 0, 0); $prezime = mysql_result($q30, 0, 1); $brindexa = mysql_result($q30, 0, 2); $spol = mysql_result($q30, 0, 3); if ($spol == "") { $spol = spol(mysql_result($q30, 0, 0)); } if ($spol == "M") { $student = "student"; $polozio = "položio"; } else { $student = "studentica"; $polozio = "položila"; } ?> <html> <head> <title>Zahtjev za koliziju</title> </head> <body> <p>Univerzitet u Sarajevu<br> Elektrotehnički fakultet Sarajevo<br> <?php echo $institucija_naziv; ?> </p> <p> </p> <p>Student: <?php echo "{$ime} {$prezime} ({$brindexa})"; ?> </p> <p> </p> <p><b>Predmet: ZAHTJEV ZA KOLIZIJU</b></p> <p> </p> <p>Ja, <?php echo "{$ime} {$prezime}"; ?> , <?php echo $student; ?> studija <?php echo $studij_naziv; ?> , <?php echo $godina_studija; ?> . godina, broj indexa <?php echo $brindexa; ?> , <?php echo $tekst_mijenja; ?> molim Vas da mi u skladu sa Zakonom o visokom obrazovanju Kantona Sarajevo, u <?php echo $tekst_semestar; ?> semestru akademske <?php echo $agnaziv; ?> godine odobrite slušanje sljedećih predmeta sa <?php echo $godina_studija + 1; ?> . godine studija u koliziji:</p> <ul> <?php foreach ($predmeti_kolizija as $id => $predmet) { print "<li>{$predmet} (" . $predmeti_ects[$id] . " ECTS)</li>\n"; } ?> </ul> <p> </p> <p>Obzirom da sa <?php echo $godina_studija; ?> . godine studija nisam <?php echo $polozio; ?> sljedeće predmete:</p> <ul> <?php foreach ($predmeti_prenos as $id => $predmet) { print "<li>{$predmet} (" . $predmeti_ects[$id] . " ECTS)</li>\n"; } ?> </ul> te da se jedan predmet prenosi, nije prekoračen maksimalan broj od 30 ECTS kredita po semestru.</p> <p> </p> <p>U nadi da ćete udovoljiti mom zahtjevu,</p> <p> </p> <table border="0"><tr><td width="100%"> </td><td align="right"><p> </p><p>_____________________________________</p></td></tr> <tr><td width="100%"> </td><td align="center"><?php echo "{$ime} {$prezime}"; ?> </td></tr></table> </body> </html> <?php return; $q5 = myquery("select uu.id, s.id, s.naziv, s.naziv_en, uu.semestar, s.tipstudija from ugovoroucenju as uu, studij as s where uu.student={$userid} and uu.akademska_godina={$zagodinu} and uu.studij=s.id order by semestar desc limit 1"); if (mysql_num_rows($q5) < 1) { niceerror("Nije kreiran ugovor o učenju za studenta."); return; } $ugovorid = mysql_result($q5, 0, 0); $studij = mysql_result($q5, 0, 1); $studijbos = mysql_result($q5, 0, 2); $studijbos = substr($studijbos, 0, strpos($studijbos, "(") - 1); $studijeng = mysql_result($q5, 0, 3); $sem2 = mysql_result($q5, 0, 4); $tipstudija = mysql_result($q5, 0, 5); $sem1 = $sem2 - 1; $godina = $sem2 / 2; // Ostali podaci o osobi $q10 = myquery("select ime, prezime, brindexa from osoba where id={$userid}"); $imeprezime = mysql_result($q10, 0, 0) . " " . mysql_result($q10, 0, 1); $brindexa = mysql_result($q10, 0, 2); // Najnoviji plan za odabrani studij $q6 = myquery("select godina_vazenja from plan_studija where studij={$studij} order by godina_vazenja desc limit 1"); if (mysql_num_rows($q6) < 1) { niceerror("Nepostojeći studij"); return; } $najnoviji_plan = mysql_result($q6, 0, 0); // Da li je ponovac? $q20 = myquery("select semestar from student_studij where student={$userid} and studij={$studij} and akademska_godina={$proslagodina} order by semestar desc limit 1"); if ($sem1 > mysql_result($q20, 0, 0)) { $ponovac = 0; } else { $ponovac = 1; } // Odredjujemo da li ima prenesenih predmeta // TODO: ovo sada ne radi za izborne predmete $q20 = myquery("select p.sifra, p.naziv, p.ects, ps.semestar from predmet as p, plan_studija as ps where ps.godina_vazenja={$najnoviji_plan} and ps.studij={$studij} and (ps.semestar=" . ($sem1 - 1) . " or ps.semestar=" . ($sem1 - 2) . ") and ps.obavezan=1 and ps.predmet=p.id and (select count(*) from konacna_ocjena as ko where ko.student={$userid} and ko.predmet=p.id)=0"); if (mysql_num_rows($q20) > 1) { niceerror("Nemate uslove za upis {$godina}. godine studija"); print "Sačekajte da prikupite uslov ili popunite Ugovor za prethodnu godinu studija."; return; } if (mysql_num_rows($q20) == 1) { $ima_preneseni = 1; $preneseni_sifra = mysql_result($q20, 0, 0); $preneseni_naziv = mysql_result($q20, 0, 1); $preneseni_ects = mysql_result($q20, 0, 2); $preneseni_semestar = mysql_result($q20, 0, 3); } else { $ima_preneseni = 0; } // Privremeni hack za master if ($tipstudija == 3) { $mscfile = "-msc"; } else { if ($tipstudija == 2) { $mscfile = ""; } } // Ako čovjek upisuje prvu godinu nečeka (mastera), broj indexa je netačan! if ($godina == 1) { $brindexa = ""; } // ----- Pravljenje PDF dokumenta $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); // set document information $pdf->SetCreator("Zamger"); $pdf->SetTitle('Domestic Learning Agreement / Ugovor o ucenju'); // set default monospaced font $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); //set margins $pdf->SetMargins(0, 0, 0); //set auto page breaks $pdf->SetAutoPageBreak(false); //set image scale factor $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); //$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO*2.083333); $pdf->setJPEGQuality(100); //set some language-dependent strings $pdf->setLanguageArray($l); // --------------------------------------------------------- // set font $pdf->SetFont('freesans', 'B', 9); $pdf->SetHeaderData("", 0, "", ""); $pdf->SetPrintHeader(false); $pdf->SetPrintFooter(false); // add a page $pdf->AddPage(); // $pdf->Image("images/content/150dpi/ETF-Domestic-contract-PGS-ALL-0.png",210,297,0,0,'','','',true,150); $pdf->Image("images/content/150dpi/domestic-contract{$mscfile}-0.png", 0, 0, 210, 0, '', '', '', true, 150); $pdf->SetXY(175, 34); $pdf->Cell(23, 0, $agnaziv, 0, 0, 'C'); $pdf->SetXY(175, 42); $pdf->Cell(23, 0, $godina . ".", 0, 0, 'C'); $pdf->SetXY(175, 50); $pdf->Cell(23, 0, $sem1 . ". & " . $sem2, 0, 0, 'C'); $pdf->SetXY(70, 48); $pdf->Cell(100, 0, $studijeng, 0, 0); $pdf->SetXY(70, 52); $pdf->Cell(100, 0, $studijbos, 0, 0); $pdf->SetXY(70, 62); $pdf->Cell(100, 0, $imeprezime); $pdf->SetXY(70, 69); $pdf->Cell(100, 0, $brindexa); // PRVI SEMESTAR $pdf->AddPage(); $pdf->Image("images/content/150dpi/domestic-contract{$mscfile}-1.png", 0, 0, 210); $pdf->SetXY(175, 34); $pdf->Cell(23, 0, $agnaziv, 0, 0, 'C'); $pdf->SetXY(175, 42); $pdf->Cell(23, 0, $godina . ".", 0, 0, 'C'); $pdf->SetXY(175, 50); $pdf->Cell(23, 0, $sem1 . ".", 0, 0, 'C'); $pdf->SetXY(70, 48); $pdf->Cell(100, 0, $studijeng, 0, 0); $pdf->SetXY(70, 52); $pdf->Cell(100, 0, $studijbos, 0, 0); $pdf->SetXY(70, 62); $pdf->Cell(100, 0, $imeprezime); $pdf->SetXY(70, 69); $pdf->Cell(100, 0, $brindexa); // Spisak obaveznih predmeta na neparnom semestru // Ako je ponovac, ne prikazujemo predmete koje je polozio if ($ponovac == 1) { $q100 = myquery("select p.sifra, p.naziv, p.ects from predmet as p, plan_studija as ps where ps.godina_vazenja={$najnoviji_plan} and ps.studij={$studij} and ps.semestar={$sem1} and ps.obavezan=1 and ps.predmet=p.id and (select count(*) from konacna_ocjena as ko where ko.student={$userid} and ko.predmet=p.id)=0"); } else { // Ako nije, trebamo prikazati one koje je položio u koliziji $q100 = myquery("select p.sifra, p.naziv, p.ects from predmet as p, plan_studija as ps where ps.godina_vazenja={$najnoviji_plan} and ps.studij={$studij} and ps.semestar={$sem1} and ps.obavezan=1 and ps.predmet=p.id"); } $ykoord = 95; $ects = 0; while ($r100 = mysql_fetch_row($q100)) { $pdf->SetXY(13, $ykoord); $pdf->Cell(100, 0, $r100[0]); $pdf->SetXY(50, $ykoord); $pdf->Cell(100, 0, $r100[1]); $e = "{$r100['2']}"; if (!strchr($e, ".")) { $e .= ".0"; } $pdf->SetXY(170, $ykoord); $pdf->Cell(100, 0, $e); $ykoord += 4; $ects += $r100[2]; } // Da li je prenesen predmet na neparnom semestru? if ($ima_preneseni && $preneseni_semestar % 2 == 1) { $pdf->SetXY(13, $ykoord); $pdf->Cell(100, 0, $preneseni_sifra); $pdf->SetXY(50, $ykoord); $pdf->Cell(100, 0, $preneseni_naziv); $e = "{$preneseni_ects}"; if (!strchr($e, ".")) { $e .= ".0"; } $pdf->SetXY(170, $ykoord); $pdf->Cell(100, 0, $e); $ykoord += 4; $ects += $preneseni_ects; } // Spisak izbornih predmeta if ($ponovac == 1) { $q110 = myquery("select p.sifra, p.naziv, p.ects from predmet as p, ugovoroucenju_izborni as uoui, ugovoroucenju as uu where uoui.ugovoroucenju=uu.id and uu.student={$userid} and uu.akademska_godina={$zagodinu} and uoui.predmet=p.id and uu.semestar={$sem1} and (select count(*) from konacna_ocjena as ko where ko.student={$userid} and ko.predmet=p.id)=0"); } else { $q110 = myquery("select p.sifra, p.naziv, p.ects from predmet as p, ugovoroucenju_izborni as uoui, ugovoroucenju as uu where uoui.ugovoroucenju=uu.id and uu.student={$userid} and uu.akademska_godina={$zagodinu} and uoui.predmet=p.id and uu.semestar={$sem1}"); } $ykoord = 123; while ($r110 = mysql_fetch_row($q110)) { $pdf->SetXY(13, $ykoord); $pdf->Cell(100, 0, $r110[0]); $pdf->SetXY(50, $ykoord); $pdf->Cell(100, 0, $r110[1]); $e = "{$r110['2']}"; if (!strchr($e, ".")) { $e .= ".0"; } $pdf->SetXY(170, $ykoord); $pdf->Cell(100, 0, $e); $ykoord += 4; $ects += $r110[2]; } // Suma ects if (!strchr($ects, ".")) { $ects .= ".0"; } $pdf->SetXY(170, 135); $pdf->Cell(100, 0, $ects); // DRUGI SEMESTAR $pdf->AddPage(); $pdf->Image("images/content/150dpi/domestic-contract{$mscfile}-2.png", 0, 0, 210); $pdf->SetXY(175, 34); $pdf->Cell(23, 0, $agnaziv, 0, 0, 'C'); $pdf->SetXY(175, 42); $pdf->Cell(23, 0, $godina . ".", 0, 0, 'C'); $pdf->SetXY(175, 50); $pdf->Cell(23, 0, $sem2 . ".", 0, 0, 'C'); $pdf->SetXY(70, 48); $pdf->Cell(100, 0, $studijeng, 0, 0); $pdf->SetXY(70, 52); $pdf->Cell(100, 0, $studijbos, 0, 0); $pdf->SetXY(70, 62); $pdf->Cell(100, 0, $imeprezime); $pdf->SetXY(70, 69); $pdf->Cell(100, 0, $brindexa); // Spisak obaveznih predmeta na parnom semestru if ($ponovac == 1) { $q100 = myquery("select p.sifra, p.naziv, p.ects from predmet as p, plan_studija as ps where ps.godina_vazenja={$najnoviji_plan} and ps.studij={$studij} and ps.semestar={$sem2} and ps.obavezan=1 and ps.predmet=p.id and (select count(*) from konacna_ocjena as ko where ko.student={$userid} and ko.predmet=p.id)=0"); } else { $q100 = myquery("select p.sifra, p.naziv, p.ects from predmet as p, plan_studija as ps where ps.godina_vazenja={$najnoviji_plan} and ps.studij={$studij} and ps.semestar={$sem2} and ps.obavezan=1 and ps.predmet=p.id"); } $ykoord = 95; $ects = 0; while ($r100 = mysql_fetch_row($q100)) { $pdf->SetXY(13, $ykoord); $pdf->Cell(100, 0, $r100[0]); $pdf->SetXY(50, $ykoord); $pdf->Cell(100, 0, $r100[1]); $e = "{$r100['2']}"; if (!strchr($e, ".")) { $e .= ".0"; } $pdf->SetXY(170, $ykoord); $pdf->Cell(100, 0, $e); $ykoord += 4; $ects += $r100[2]; } // Da li je prenesen predmet na parnom semestru? if ($ima_preneseni && $preneseni_semestar % 2 == 0) { $pdf->SetXY(13, $ykoord); $pdf->Cell(100, 0, $preneseni_sifra); $pdf->SetXY(50, $ykoord); $pdf->Cell(100, 0, $preneseni_naziv); $e = "{$preneseni_ects}"; if (!strchr($e, ".")) { $e .= ".0"; } $pdf->SetXY(170, $ykoord); $pdf->Cell(100, 0, $e); $ykoord += 4; $ects += $preneseni_ects; } // Spisak izbornih predmeta if ($ponovac == 1) { $q110 = myquery("select p.sifra, p.naziv, p.ects from predmet as p, ugovoroucenju_izborni as uoui, ugovoroucenju as uu where uoui.ugovoroucenju=uu.id and uu.student={$userid} and uu.akademska_godina={$zagodinu} and uoui.predmet=p.id and uu.semestar={$sem2} and (select count(*) from konacna_ocjena as ko where ko.student={$userid} and ko.predmet=p.id)=0"); } else { $q110 = myquery("select p.sifra, p.naziv, p.ects from predmet as p, ugovoroucenju_izborni as uoui, ugovoroucenju as uu where uoui.ugovoroucenju=uu.id and uu.student={$userid} and uu.akademska_godina={$zagodinu} and uoui.predmet=p.id and uu.semestar={$sem2}"); } $ykoord = 123; while ($r110 = mysql_fetch_row($q110)) { $pdf->SetXY(13, $ykoord); $pdf->Cell(100, 0, $r110[0]); $pdf->SetXY(50, $ykoord); $pdf->Cell(100, 0, $r110[1]); $e = "{$r110['2']}"; if (!strchr($e, ".")) { $e .= ".0"; } $pdf->SetXY(170, $ykoord); $pdf->Cell(100, 0, $e); $ykoord += 4; $ects += $r110[2]; } // Suma ects if (!strchr($ects, ".")) { $ects .= ".0"; } $pdf->SetXY(170, 135); $pdf->Cell(100, 0, $ects); // --------------------------------------------------------- //Close and output PDF document $pdf->Output('ugovor_o_ucenju.pdf', 'I'); //============================================================+ // END OF FILE //============================================================+ }
/** * Adds to the TCPDF instance, the data related to a row in the GIS dataset. * * @param string $spatial GIS MULTIPOINT object * @param string $label Label for the GIS MULTIPOINT object * @param string $point_color Color for the GIS MULTIPOINT object * @param array $scale_data Array containing data related to scaling * @param TCPDF $pdf TCPDF instance * * @return TCPDF the modified TCPDF instance * @access public */ public function prepareRowAsPdf($spatial, $label, $point_color, $scale_data, $pdf) { /** @var PMA_String $pmaString */ $pmaString = $GLOBALS['PMA_String']; // allocate colors $red = hexdec($pmaString->substr($point_color, 1, 2)); $green = hexdec($pmaString->substr($point_color, 3, 2)); $blue = hexdec($pmaString->substr($point_color, 4, 2)); $line = array('width' => 1.25, 'color' => array($red, $green, $blue)); // Trim to remove leading 'MULTIPOINT(' and trailing ')' $multipoint = $pmaString->substr($spatial, 11, $pmaString->strlen($spatial) - 12); $points_arr = $this->extractPoints($multipoint, $scale_data); foreach ($points_arr as $point) { // draw a small circle to mark the point if ($point[0] != '' && $point[1] != '') { $pdf->Circle($point[0], $point[1], 2, 0, 360, 'D', $line); } } // print label for each point if (isset($label) && trim($label) != '' && ($points_arr[0][0] != '' && $points_arr[0][1] != '')) { $pdf->SetXY($points_arr[0][0], $points_arr[0][1]); $pdf->SetFontSize(5); $pdf->Cell(0, 0, trim($label)); } return $pdf; }
/** * Adds to the TCPDF instance, the data related to a row in the GIS dataset. * * @param string $spatial GIS POLYGON object * @param string $label Label for the GIS POLYGON object * @param string $fill_color Color for the GIS POLYGON object * @param array $scale_data Array containing data related to scaling * @param TCPDF $pdf TCPDF instance * * @return TCPDF the modified TCPDF instance * @access public */ public function prepareRowAsPdf($spatial, $label, $fill_color, $scale_data, $pdf) { // allocate colors $red = hexdec(mb_substr($fill_color, 1, 2)); $green = hexdec(mb_substr($fill_color, 3, 2)); $blue = hexdec(mb_substr($fill_color, 4, 2)); $color = array($red, $green, $blue); // Trim to remove leading 'POLYGON((' and trailing '))' $polygon = mb_substr($spatial, 9, mb_strlen($spatial) - 11); // If the polygon doesn't have an inner polygon if (mb_strpos($polygon, "),(") === false) { $points_arr = $this->extractPoints($polygon, $scale_data, true); } else { // Separate outer and inner polygons $parts = explode("),(", $polygon); $outer = $parts[0]; $inner = array_slice($parts, 1); $points_arr = $this->extractPoints($outer, $scale_data, true); foreach ($inner as $inner_poly) { $points_arr = array_merge($points_arr, $this->extractPoints($inner_poly, $scale_data, true)); } } // draw polygon $pdf->Polygon($points_arr, 'F*', array(), $color, true); // print label if applicable if (isset($label) && trim($label) != '') { $pdf->SetXY($points_arr[2], $points_arr[3]); $pdf->SetFontSize(5); $pdf->Cell(0, 0, trim($label)); } return $pdf; }
public function testPdfOutput() { // create new PDF document $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); // set document information $pdf->SetCreator(PDF_CREATOR); $pdf->SetAuthor('Nicola Asuni'); $pdf->SetTitle('TCPDF Example 023'); $pdf->SetSubject('TCPDF Tutorial'); $pdf->SetKeywords('TCPDF, PDF, example, test, guide'); // set default header data $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE . ' 023', 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 (optional) $pdf->setLanguageArray($this->langSettings); // --------------------------------------------------------- // set font $pdf->SetFont('times', 'BI', 14); // Start First Page Group $pdf->startPageGroup(); // add a page $pdf->AddPage(); // set some text to print $txt = <<<EOD Example of page groups. Check the page numbers on the page footer. This is the first page of group 1. EOD; // print a block of text using Write() $pdf->Write(0, $txt, '', 0, 'L', true, 0, false, false, 0); // add second page $pdf->AddPage(); $pdf->Cell(0, 10, 'This is the second page of group 1', 0, 1, 'L'); // Start Second Page Group $pdf->startPageGroup(); // add some pages $pdf->AddPage(); $pdf->Cell(0, 10, 'This is the first page of group 2', 0, 1, 'L'); $pdf->AddPage(); $pdf->Cell(0, 10, 'This is the second page of group 2', 0, 1, 'L'); $pdf->AddPage(); $pdf->Cell(0, 10, 'This is the third page of group 2', 0, 1, 'L'); $pdf->AddPage(); $pdf->Cell(0, 10, 'This is the fourth page of group 2', 0, 1, 'L'); $this->comparePdfs($pdf); }
public function testPdfOutput() { // create new PDF document $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); // set document information $pdf->SetCreator(PDF_CREATOR); $pdf->SetAuthor('Nicola Asuni'); $pdf->SetTitle('TCPDF Example 029'); $pdf->SetSubject('TCPDF Tutorial'); $pdf->SetKeywords('TCPDF, PDF, example, test, guide'); // set default header data $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE . ' 029', 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 (optional) $pdf->setLanguageArray($this->langSettings); // --------------------------------------------------------- // set array for viewer preferences $preferences = array('HideToolbar' => true, 'HideMenubar' => true, 'HideWindowUI' => true, 'FitWindow' => true, 'CenterWindow' => true, 'DisplayDocTitle' => true, 'NonFullScreenPageMode' => 'UseNone', 'ViewArea' => 'CropBox', 'ViewClip' => 'CropBox', 'PrintArea' => 'CropBox', 'PrintClip' => 'CropBox', 'PrintScaling' => 'AppDefault', 'Duplex' => 'DuplexFlipLongEdge', 'PickTrayByPDFSize' => true, 'PrintPageRange' => array(1, 1, 2, 3), 'NumCopies' => 2); // Check the example n. 60 for advanced page settings // set pdf viewer preferences $pdf->setViewerPreferences($preferences); // set font $pdf->SetFont('times', '', 14); // add a page $pdf->AddPage(); // print a line $pdf->Cell(0, 12, 'DISPLAY PREFERENCES - PAGE 1', 1, 1, 'C'); $pdf->Ln(5); $pdf->Write(0, 'You can use the setViewerPreferences() method to change viewer preferences.', '', 0, 'L', true, 0, false, false, 0); // add a page $pdf->AddPage(); // print a line $pdf->Cell(0, 12, 'DISPLAY PREFERENCES - PAGE 2', 0, 0, 'C'); // add a page $pdf->AddPage(); // print a line $pdf->Cell(0, 12, 'DISPLAY PREFERENCES - PAGE 3', 0, 0, 'C'); $this->comparePdfs($pdf); }
/** * @param $lInfo * @param $newLine */ private function buildLabel_Barcodes($lInfo, $newLine) { $labelContent = array(); if ($lInfo['barcode'] != '') { if ($lInfo['barcode_type'] != '') { $labelContent[] = $this->getTcpdfBarcode($lInfo); } else { $labelContent[] = 'Image Not Available'; } } $first = 0; $labelText = ''; foreach ($labelContent as $iLabel) { if ($first == 1) { $labelText .= "\n" . ltrim(str_replace('<br>', "\n", str_replace('<br />', "\n", str_replace('<br/>', "\n", preg_replace("/(?:\\s\\s+|\n|\t)/", " ", $iLabel))))); } else { $labelText .= ltrim(str_replace('<br>', "\n", str_replace('<br />', "\n", str_replace('<br/>', "\n", preg_replace("/(?:\\s\\s+|\n|\t)/", " ", $iLabel))))); } $first++; } $this->pdf->MultiCell($this->layoutInfo['labelWidth'], $this->layoutInfo['labelHeight'], $labelText, 0, 'C', 0, $newLine, '', '', true, 0, true, true, $this->layoutInfo['labelHeight'], 'M', true); if ($newLine == 0) { $this->pdf->Cell($this->layoutInfo['labelSpacerWidth'], $this->layoutInfo['labelHeight'], ''); } }
public function testPdfOutput() { // create new PDF document $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); // set document information $pdf->SetCreator(PDF_CREATOR); $pdf->SetAuthor('Nicola Asuni'); $pdf->SetTitle('TCPDF Example 060'); $pdf->SetSubject('TCPDF Tutorial'); $pdf->SetKeywords('TCPDF, PDF, example, test, guide'); // set default header data $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE . ' 060', 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 (optional) $pdf->setLanguageArray($this->langSettings); // set font $pdf->SetFont('helvetica', '', 20); // --------------------------------------------------------- // set page format (read source code documentation for further information) $page_format = array('MediaBox' => array('llx' => 0, 'lly' => 0, 'urx' => 210, 'ury' => 297), 'CropBox' => array('llx' => 0, 'lly' => 0, 'urx' => 210, 'ury' => 297), 'BleedBox' => array('llx' => 5, 'lly' => 5, 'urx' => 205, 'ury' => 292), 'TrimBox' => array('llx' => 10, 'lly' => 10, 'urx' => 200, 'ury' => 287), 'ArtBox' => array('llx' => 15, 'lly' => 15, 'urx' => 195, 'ury' => 282), 'Dur' => 3, 'trans' => array('D' => 1.5, 'S' => 'Split', 'Dm' => 'V', 'M' => 'O'), 'Rotate' => 90, 'PZ' => 1); // Check the example n. 29 for viewer preferences // add first page --- $pdf->AddPage('P', $page_format, false, false); $pdf->Cell(0, 12, 'First Page', 1, 1, 'C'); // add second page --- $page_format['Rotate'] = 270; $pdf->AddPage('P', $page_format, false, false); $pdf->Cell(0, 12, 'Second Page', 1, 1, 'C'); // --------------------------------------------------------- $this->comparePdfs($pdf); }
public function testPdfOutput() { // create new PDF document $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); // set document information $pdf->SetCreator(PDF_CREATOR); $pdf->SetAuthor('Nicola Asuni'); $pdf->SetTitle('TCPDF Example 035'); $pdf->SetSubject('TCPDF Tutorial'); $pdf->SetKeywords('TCPDF, PDF, example, test, guide'); // set default header data $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE . ' 035', 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 (optional) $pdf->setLanguageArray($this->langSettings); // --------------------------------------------------------- // set font $pdf->SetFont('times', 'BI', 16); // add a page $pdf->AddPage(); $pdf->Write(0, 'Example of SetLineStyle() method', '', 0, 'L', true, 0, false, false, 0); $pdf->Ln(); $pdf->SetLineStyle(array('width' => 0.5, 'cap' => 'butt', 'join' => 'miter', 'dash' => 4, 'color' => array(255, 0, 0))); $pdf->SetFillColor(255, 255, 128); $pdf->SetTextColor(0, 0, 128); $text = "DUMMY"; $pdf->Cell(0, 0, $text, 1, 1, 'L', 1, 0); $pdf->Ln(); $pdf->SetLineStyle(array('width' => 0.5, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 255))); $pdf->SetFillColor(255, 255, 0); $pdf->SetTextColor(0, 0, 255); $pdf->MultiCell(60, 4, $text, 1, 'C', 1, 0); $pdf->SetLineStyle(array('width' => 0.5, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(255, 255, 0))); $pdf->SetFillColor(0, 0, 255); $pdf->SetTextColor(255, 255, 0); $pdf->MultiCell(60, 4, $text, 'TB', 'C', 1, 0); $pdf->SetLineStyle(array('width' => 0.5, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(255, 0, 255))); $pdf->SetFillColor(0, 255, 0); $pdf->SetTextColor(255, 0, 255); $pdf->MultiCell(60, 4, $text, 1, 'C', 1, 1); $this->comparePdfs($pdf); }
function pdf($kul) { require "/opt/tcpdf/tcpdf.php"; $pdf = new TCPDF('P', 'mm', 'A4', true, 'UTF-8', false); $pdf->SetTitle('OMU UZEM 2010-2011 ÖN KAYIT FORMU'); $pdf->SetAuthor('Anonim'); $pdf->SetFont('dejavusans', '', 12); $pdf->SetMargins(20, 60, 20); $pdf->SetHeaderMargin(10); $pdf->SetFooterMargin(10); $pdf->SetHeaderData('uzem-head.jpg', 170, '', ''); $pdf->AddPage(); $pdf->SetFont('dejavusans', 'B', 18); $pdf->Cell(0, 5, "2010-2011 Ebelik Lisans Tamamlama", 0, 1, 'C'); $pdf->Cell(0, 5, "Ön Kayıt Başvurusu", 0, 1, 'C'); $pdf->Ln(5); $bilgiler = array('Kişisel Bilgiler' => array('tc' => 'TC Kimlik No', 'ad' => 'Ad', 'soyad' => 'Soyad', 'kizliksoyad' => 'Kızlık Soyadı', 'babaad' => 'Baba Adı', 'anaad' => 'Ana Adı', 'dogumil' => 'Doğum Yeri', 'dogumyil' => 'Doğum Yılı'), 'İletişim Bilgileri' => array('ceptel' => 'Cep Tel', 'evtel' => 'Ev Tel', 'email' => 'Email', 'evadres' => 'Ev Adres', 'il' => 'İl', 'ilce' => 'İlçe', 'uni' => 'Üniversite'), 'İş Bilgileri' => array('calismakurum' => 'Kurum', 'calismabirim' => 'Birim', 'isil' => 'İl', 'isilce' => 'İlçe'), 'Diğer Bilgiler' => array('tarih' => 'Ön Kayıt Tarihi')); foreach ($bilgiler as $kesim => $bilgi) { $pdf->SetFont('dejavusans', 'B', 14); $pdf->Cell(0, 5, $kesim, 0, 1, 'L'); $pdf->SetFont('dejavusans', '', 10); foreach ($bilgi as $alan => $baslik) { $deger = $kul->{$alan}; $pdf->MultiCell(30, 1, $baslik . ':', 0, 'L', 0, 0, '25', '', true); $pdf->MultiCell(180, 1, $deger, 0, 'L', 0, 0, '', '', true); $pdf->Ln(5); } $pdf->Ln(5); } $pdf->Ln(15); $pdf->Cell(0, 5, "Yukarıda vermiş olduğum bilgilerin doğruluğunu kabul ediyorum.", 0, 1, 'T'); $pdf->Ln(5); $pdf->MultiCell(50, 1, 'Tarih:', 0, 'L', 0, 1, '120', '', true); $pdf->MultiCell(50, 1, 'Ad Soyad:', 0, 'L', 0, 1, '120', '', true); $pdf->MultiCell(50, 1, 'İmza:', 0, 'L', 0, 1, '120', '', true); $pdf->Output(); }
public function checkoverflow($arraydata, $txt = "") { $this->print_expression($arraydata); if ($this->print_expression_result == true) { if ($arraydata["link"]) { $arraydata["link"] = $this->analyse_expression($arraydata["link"], ""); } if ($arraydata["writeHTML"] == 1 && $this->pdflib == "TCPDF") { $this->pdf->writeHTML($txt); } elseif ($arraydata["poverflow"] == "true" && $arraydata["soverflow"] == "false") { $this->pdf->Cell($arraydata["width"], $arraydata["height"], $this->formatText($txt, $arraydata["pattern"]), $arraydata["border"], "", $arraydata["align"], $arraydata["fill"], $arraydata["link"]); } elseif ($arraydata["poverflow"] == "false" && $arraydata["soverflow"] == "false") { while ($this->pdf->GetStringWidth($txt) > $arraydata["width"]) { $txt = substr_replace($txt, "", -1); } $this->pdf->Cell($arraydata["width"], $arraydata["height"], $this->formatText($txt, $arraydata["pattern"]), $arraydata["border"], "", $arraydata["align"], $arraydata["fill"], $arraydata["link"]); } elseif ($arraydata["poverflow"] == "false" && $arraydata["soverflow"] == "true") { $this->pdf->MultiCell($arraydata["width"], $arraydata["height"], $this->formatText($txt, $arraydata["pattern"]), $arraydata["border"], $arraydata["align"], $arraydata["fill"]); } else { $this->pdf->MultiCell($arraydata["width"], $arraydata["height"], $this->formatText($txt, $arraydata["pattern"]), $arraydata["border"], $arraydata["align"], $arraydata["fill"]); } } $this->print_expression_result = false; }
fileSelect: Text file selection format. password: Text password format. alignment: Text layout in text fields. buttonAlignX: X alignment of icon on button face. buttonAlignY: Y alignment of icon on button face. buttonFitBounds: Relative scaling of an icon to fit inside a button face. buttonScaleHow: Relative scaling of an icon to fit inside a button face. buttonScaleWhen: Relative scaling of an icon to fit inside a button face. highlight: Appearance of a button when pushed. style: Glyph style for checkbox and radio buttons. numItems: Number of items in a combo box or list box. editable: Whether the user can type in a combo box. multipleSelection: Whether multiple list box items may be selected. Colors can be chosen in the following list (case sensitive): black white red green blue cyan magenta yellow dkGray gray ltGray or be in the form #RRGGBB. */ $pdf->Cell(0, 5, 'Subscription form', 0, 1, 'C'); $pdf->Ln(10); $pdf->SetFont('', '', 12); //First name $pdf->Cell(35, 5, 'First name:'); $pdf->TextField('firstname', 50, 5, array('strokeColor' => 'ltGray')); $pdf->Ln(6); //Last name $pdf->Cell(35, 5, 'Last name:'); $pdf->TextField('lastname', 50, 5, array('strokeColor' => 'ltGray')); $pdf->Ln(6); //Gender $pdf->Cell(35, 5, 'Gender:'); $pdf->ComboBox('gender', 10, 5, array('', 'M', 'F'), array('strokeColor' => 'ltGray')); $pdf->Ln(6); //Drink
//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', '', 18); // print a line using Cell() $pdf->AddPage(); $pdf->Cell(0, 10, 'PAGE A', 0, 1, 'L'); $pdf->AddPage(); $pdf->Cell(0, 10, 'PAGE B', 0, 1, 'L'); $pdf->AddPage(); $pdf->Cell(0, 10, 'PAGE D', 0, 1, 'L'); $pdf->AddPage(); $pdf->Cell(0, 10, 'PAGE E', 0, 1, 'L'); $pdf->AddPage(); $pdf->Cell(0, 10, 'PAGE E-2', 0, 1, 'L'); $pdf->AddPage(); $pdf->Cell(0, 10, 'PAGE F', 0, 1, 'L'); $pdf->AddPage(); $pdf->Cell(0, 10, 'PAGE C', 0, 1, 'L'); $pdf->AddPage(); $pdf->Cell(0, 10, 'PAGE G', 0, 1, 'L'); // Move page 7 to page 3
//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', 'B', 40); // print a line using Cell() $pdf->AddPage(); $pdf->Cell(0, 10, 'PAGE: A', 0, 1, 'L'); // add some vertical space $pdf->Ln(10); // print some text $pdf->SetFont('times', 'I', 16); $txt = 'TCPDF allows you to Copy, Move and Delete pages.'; $pdf->Write(0, $txt, '', 0, 'L', true, 0, false, false, 0); $pdf->SetFont('helvetica', 'B', 40); $pdf->AddPage(); $pdf->Cell(0, 10, 'PAGE: B', 0, 1, 'L'); $pdf->AddPage(); $pdf->Cell(0, 10, 'PAGE: D', 0, 1, 'L'); $pdf->AddPage(); $pdf->Cell(0, 10, 'PAGE: E', 0, 1, 'L'); $pdf->AddPage(); $pdf->Cell(0, 10, 'PAGE: E-2', 0, 1, 'L');
function getReportPDF($filterlist = false) { require_once 'libraries/tcpdf/tcpdf.php'; $reportData = $this->GenerateReport("PDF", $filterlist); $arr_val = $reportData['data']; if (isset($arr_val)) { foreach ($arr_val as $wkey => $warray_value) { foreach ($warray_value as $whd => $wvalue) { if (strlen($wvalue) < strlen($whd)) { $w_inner_array[] = strlen($whd); } else { $w_inner_array[] = strlen($wvalue); } } $warr_val[] = $w_inner_array; unset($w_inner_array); } foreach ($warr_val[0] as $fkey => $fvalue) { foreach ($warr_val as $wkey => $wvalue) { $f_inner_array[] = $warr_val[$wkey][$fkey]; } sort($f_inner_array, 1); $farr_val[] = $f_inner_array; unset($f_inner_array); } foreach ($farr_val as $skkey => $skvalue) { if ($skvalue[count($arr_val) - 1] == 1) { $col_width[] = $skvalue[count($arr_val) - 1] * 50; } else { $col_width[] = $skvalue[count($arr_val) - 1] * 10 + 10; } } $count = 0; foreach ($arr_val[0] as $key => $value) { $headerHTML .= '<td width="' . $col_width[$count] . '" bgcolor="#DDDDDD"><b>' . $this->getLstringforReportHeaders($key) . '</b></td>'; $count = $count + 1; } foreach ($arr_val as $key => $array_value) { $valueHTML = ""; $count = 0; foreach ($array_value as $hd => $value) { $valueHTML .= '<td width="' . $col_width[$count] . '">' . $value . '</td>'; $count = $count + 1; } $dataHTML .= '<tr>' . $valueHTML . '</tr>'; } } $totalpdf = $this->GenerateReport("PRINT_TOTAL", $filterlist); $html = '<table border="0.5"><tr>' . $headerHTML . '</tr>' . $dataHTML . '<tr><td>' . $totalpdf . '</td></tr>' . '</table>'; $columnlength = array_sum($col_width); if ($columnlength > 14400) { die("<br><br><center>" . $app_strings['LBL_PDF'] . " <a href='javascript:window.history.back()'>" . $app_strings['LBL_GO_BACK'] . ".</a></center>"); } if ($columnlength <= 420) { $pdf = new TCPDF('P', 'mm', 'A5', true); } elseif ($columnlength >= 421 && $columnlength <= 1120) { $pdf = new TCPDF('L', 'mm', 'A3', true); } elseif ($columnlength >= 1121 && $columnlength <= 1600) { $pdf = new TCPDF('L', 'mm', 'A2', true); } elseif ($columnlength >= 1601 && $columnlength <= 2200) { $pdf = new TCPDF('L', 'mm', 'A1', true); } elseif ($columnlength >= 2201 && $columnlength <= 3370) { $pdf = new TCPDF('L', 'mm', 'A0', true); } elseif ($columnlength >= 3371 && $columnlength <= 4690) { $pdf = new TCPDF('L', 'mm', '2A0', true); } elseif ($columnlength >= 4691 && $columnlength <= 6490) { $pdf = new TCPDF('L', 'mm', '4A0', true); } else { $columnhight = count($arr_val) * 15; $format = array($columnhight, $columnlength); $pdf = new TCPDF('L', 'mm', $format, true); } $pdf->SetMargins(10, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); $pdf->SetHeaderMargin(PDF_MARGIN_HEADER); $pdf->SetFooterMargin(PDF_MARGIN_FOOTER); $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); $pdf->setLanguageArray($l); $pdf->AddPage(); $pdf->SetFillColor(224, 235, 255); $pdf->SetTextColor(0); $pdf->SetFont('FreeSerif', 'B', 14); $pdf->Cell($pdf->columnlength * 50, 10, getTranslatedString($oReport->reportname), 0, 0, 'C', 0); //$pdf->writeHTML($oReport->reportname); $pdf->Ln(); $pdf->SetFont('FreeSerif', '', 10); $pdf->writeHTML($html); return $pdf; }
public function Cell($w, $h = 0, $txt = '', $border = 0, $ln = 0, $align = '', $fill = 0, $link = '', $stretch = 0) { return parent::Cell($w, $h, to_utf8($txt), $border, $ln, $align, $fill, $link, $stretch); }
$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('times', 'BI', 16); // add a page $pdf->AddPage(); // print a line using Cell() $pdf->Cell(0, 12, 'Example 035', 1, 1, 'C'); $pdf->Ln(); $pdf->SetLineStyle(array('width' => 0.5, 'cap' => 'butt', 'join' => 'miter', 'dash' => 4, 'color' => array(255, 0, 0))); $pdf->SetFillColor(255, 255, 128); $pdf->SetTextColor(0, 0, 128); $text = "DUMMY"; $pdf->Cell(0, 0, $text, 1, 1, 'L', 1, 0); $pdf->Ln(); $pdf->SetLineStyle(array('width' => 0.5, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 255))); $pdf->SetFillColor(255, 255, 0); $pdf->SetTextColor(0, 0, 255); $pdf->MultiCell(60, 4, $text, 1, 'C', 1, 0); $pdf->SetLineStyle(array('width' => 0.5, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(255, 255, 0))); $pdf->SetFillColor(0, 0, 255); $pdf->SetTextColor(255, 255, 0); $pdf->MultiCell(60, 4, $text, 'TB', 'C', 1, 0);
$lg['a_meta_language'] = 'fa'; $lg['w_page'] = 'page'; // set some language-dependent strings (optional) $pdf->setLanguageArray($lg); // --------------------------------------------------------- // set font //$pdf->SetFont('dejavusans', '', 12); // add a page $pdf->AddPage(); // Restore RTL direction $pdf->setRTL(true); // set font $pdf->SetFont('aealarabiya', '', 18); // print newline $pdf->Ln(); $pdf->Cell(0, 12, $contratTitle, 0, 1, 'C'); $pdf->Ln(); $pdf->SetFont('aealarabiya', '', 14); //$pdf->Ln(); //$htmlcontent = '<strong>'.'الطرف الثاني'.'</strong>'; //$pdf->WriteHTML($htmlcontent, true, 0, true, 0); $htmlcontent = '<strong>' . 'الطرف الأول' . '</strong>' . ' : ' . $company->nomArabe() . '، في شخص ممثلها القانوني, و الكائن مقرها الاجتماعي ' . $company->adresseArabe() . '.'; $pdf->WriteHTML($htmlcontent, true, 0, true, 0); $pdf->Ln(); $htmlcontent = '<strong>' . 'الطرف الثاني' . '</strong>' . ': السيد(ة) ،' . $employe->nomArabe() . ' ' . 'المغربي (ة)، الراشد(ة) ، الحامل (ة)، لرقم البطاقة الوطنية رقم' . $employe->cin() . ' ' . '، العنوان و الموطن المختار و المحدد هو,' . $employe->adresseArabe() . '.'; $pdf->WriteHTML($htmlcontent, true, 0, true, 0); $pdf->SetFont('aealarabiya', '', 18); $pdf->Cell(0, 12, 'نص العقد و الاتفاق', 0, 1, 'C'); $pdf->SetFont('aealarabiya', '', 12); //Contenu du contrat //Acte 1:
$pdf->SetTitle($doc_title); $pdf->SetSubject($doc_subject); $pdf->SetKeywords($doc_keywords); $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING); //set margins $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); //set auto page breaks $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); $pdf->SetHeaderMargin(PDF_MARGIN_HEADER); $pdf->SetFooterMargin(PDF_MARGIN_FOOTER); $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); //set image scale factor $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); $pdf->setLanguageArray($l); //set language items //initialize document $pdf->AliasNbPages(); $pdf->AddPage(); // set barcode $pdf->SetBarcode(date("Y-m-d H:i:s", time())); // output some HTML code $pdf->WriteHTML($htmlcontent, true); // output some content $pdf->SetFont("helvetica", "BI", 20); $pdf->Cell(0, 10, 'TEST Bold-Italic Cell', 1, 0, 'C'); //Close and output PDF document $pdf->Output(); //============================================================+ // END OF FILE //============================================================+
$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('times', 'B', 20); // add a page $pdf->AddPage(); // set a bookmark for the current position $pdf->Bookmark('Chapter 1', 0, 0); // print a line using Cell() $pdf->Cell(0, 10, 'Chapter 1', 0, 1, 'L'); $pdf->AddPage(); $pdf->Bookmark('Paragraph 1.1', 1, 0); $pdf->Cell(0, 10, 'Paragraph 1.1', 0, 1, 'L'); $pdf->AddPage(); $pdf->Bookmark('Paragraph 1.2', 1, 0); $pdf->Cell(0, 10, 'Paragraph 1.2', 0, 1, 'L'); $pdf->AddPage(); $pdf->Bookmark('Sub-Paragraph 1.2.1', 2, 0); $pdf->Cell(0, 10, 'Sub-Paragraph 1.2.1', 0, 1, 'L'); $pdf->AddPage(); $pdf->Bookmark('Paragraph 1.3', 1, 0); $pdf->Cell(0, 10, 'Paragraph 1.3', 0, 1, 'L'); $pdf->AddPage(); $pdf->Bookmark('Chapter 2', 0, 0); $pdf->Cell(0, 10, 'Chapter 2', 0, 1, 'L');
$pdf->setImageScale ( PDF_IMAGE_SCALE_RATIO ); // set some language-dependent strings $pdf->setLanguageArray ( $l ); // --------------------------------------------------------- // set font $pdf->SetFont ( 'helvetica', 'B', 20 ); // --- first page ------------------------------------------ // add a page $pdf->AddPage (); $pdf->Cell ( 0, 0, 'TCPDF Gradients', 0, 1, 'C', 0, '', 0, false, 'T', 'M' ); // set colors for gradients (r,g,b) or (grey 0-255) $red = array ( 255, 0, 0 ); $blue = array ( 0, 0, 200 ); $yellow = array ( 255, 255,
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); //set image scale factor $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); //set some language-dependent strings $pdf->setLanguageArray($l); //initialize document $pdf->AliasNbPages(); // add a page $pdf->AddPage(); // --------------------------------------------------------- // set font $pdf->SetFont("times", "B", 20); // set a bookmark for the current position $pdf->Bookmark('Chapter 1', 0, 0); // print a line using Cell() $pdf->Cell(0, 10, "Chapter 1", 0, 1, 'L'); $pdf->AddPage(); $pdf->Bookmark('Paragraph 1.1', 1, 0); $pdf->Cell(0, 10, "Paragraph 1.1", 0, 1, 'L'); $pdf->AddPage(); $pdf->Bookmark('Paragraph 1.2', 1, 0); $pdf->Cell(0, 10, "Paragraph 1.2", 0, 1, 'L'); $pdf->AddPage(); $pdf->Bookmark('Sub-Paragraph 1.2.1', 2, 0); $pdf->Cell(0, 10, "Sub-Paragraph 1.2.1", 0, 1, 'L'); $pdf->AddPage(); $pdf->Bookmark('Paragraph 1.3', 1, 0); $pdf->Cell(0, 10, "Paragraph 1.3", 0, 1, 'L'); $pdf->AddPage(); $pdf->Bookmark('Chapter 2', 0, 0); $pdf->Cell(0, 10, "Chapter 2", 0, 1, 'L');
/** * [OVERRIDE] Cell method in tcpdf library. * Handle charset conversion and HTML entity decode. * This method override the regular Cell() method to apply the prepare_string() function to * the string to print in the PDF. * The cell method is used by all the methods which print text (Write, MultiCell). * @see include/tcpdf/TCPDF#Cell() */ public function Cell($w, $h = 0, $txt = '', $border = 0, $ln = 0, $align = '', $fill = 0, $link = '', $stretch = 0) { parent::Cell($w, $h, prepare_string($txt), $border, $ln, $align, $fill, $link, $stretch); }
// set fill color $pdf->SetFillColor ( 221, 238, 255 ); // create one HTML table for each core font foreach ( $core_fonts as $font ) { // add a page $pdf->AddPage (); // Cell($w, $h=0, $txt='', $border=0, $ln=0, $align='', $fill=false, // $link='', $stretch=0, $ignore_min_height=false, $calign='T', $valign='M') // set font for title $pdf->SetFont ( 'helvetica', 'B', 16 ); // print font name $pdf->Cell ( 0, 10, 'FONT: ' . $font, 1, 1, 'C', true, '', 0, false, 'T', 'M' ); // set font for chars $pdf->SetFont ( $font, '', 16 ); // print each character for($i = 0; $i < 256; ++ $i) { if (($i > 0) and (($i % 16) == 0)) { $pdf->Ln (); } $pdf->Cell ( 11.25, 11.25, $pdf->unichr ( $i ), 1, 0, 'C', false, '', 0, false, 'T', 'M' ); } $pdf->Ln ( 20 ); // print a pangram
$pdf->SetCreator(PDF_CREATOR); $pdf->SetAuthor('Nicola Asuni'); $pdf->SetTitle('TCPDF Example 002'); $pdf->SetSubject('TCPDF Tutorial'); $pdf->SetKeywords('TCPDF, PDF, example, test, guide'); // remove default header/footer $pdf->setPrintHeader(false); $pdf->setPrintFooter(false); //set margins $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); //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); //initialize document $pdf->AliasNbPages(); // add a page $pdf->AddPage(); // --------------------------------------------------------- // set font $pdf->SetFont('times', 'BI', 20); // print a line using Cell() $pdf->Cell(0, 10, "Example 002", 1, 1, 'C'); // --------------------------------------------------------- //Close and output PDF document $pdf->Output('example_002.pdf', 'I'); //============================================================+ // END OF FILE //============================================================+
// set default monospaced font $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); //set margins $pdf->SetMargins(10, PDF_MARGIN_TOP, 10); //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->SetDisplayMode('fullpage', 'SinglePage', 'UseNone'); // set font $pdf->SetFont('times', 'B', 20); $pdf->AddPage('P', 'A4'); $pdf->Cell(0, 0, 'A4 PORTRAIT', 1, 1, 'C'); $pdf->AddPage('L', 'A4'); $pdf->Cell(0, 0, 'A4 LANDSCAPE', 1, 1, 'C'); $pdf->AddPage('P', 'A5'); $pdf->Cell(0, 0, 'A5 PORTRAIT', 1, 1, 'C'); $pdf->AddPage('L', 'A5'); $pdf->Cell(0, 0, 'A5 LANDSCAPE', 1, 1, 'C'); $pdf->AddPage('P', 'A6'); $pdf->Cell(0, 0, 'A6 PORTRAIT', 1, 1, 'C'); $pdf->AddPage('L', 'A6'); $pdf->Cell(0, 0, 'A6 LANDSCAPE', 1, 1, 'C'); $pdf->AddPage('P', 'A7'); $pdf->Cell(0, 0, 'A7 PORTRAIT', 1, 1, 'C'); $pdf->AddPage('L', 'A7'); $pdf->Cell(0, 0, 'A7 LANDSCAPE', 1, 1, 'C'); // --- test backward editing ---
function Generate_Content() { $pdf = new TCPDF(); //kods ņemts no // http://www.tecnick.com/pagefiles/tcpdf/example_001.phps // galvene $pdf->setHeaderData("", "", "", "Atzīmju izraksts"); // set header and footer fonts $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', 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); //initialize document $pdf->AliasNbPages(); // add a page $pdf->AddPage(); // set font $pdf->SetFont("helvetica", "", 10); // print a line using Cell() $pdf->Cell(50, 12, "Skolēns: {$this->studentName}", 0, 0, 'L'); $pdf->Ln(); //ģenerē visu butisko saturu for ($i = 0; $i < count($this->grades); $i++) { $grade = $this->grades[$i]; $pdf->Cell(0, 0, sprintf("%s %s %s", $grade["date"], $grade["lesson"], $grade["grade"]), 0, 0, 'L'); $pdf->Ln(); } $this->fileContents = $pdf; }
public function testPdfOutput() { // create new PDF document $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); // set document information $pdf->SetCreator(PDF_CREATOR); $pdf->SetAuthor('Nicola Asuni'); $pdf->SetTitle('TCPDF Example 040'); $pdf->SetSubject('TCPDF Tutorial'); $pdf->SetKeywords('TCPDF, PDF, example, test, guide'); // set default header data $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE . ' 040', 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 (optional) $pdf->setLanguageArray($this->langSettings); // --------------------------------------------------------- // set display mode $pdf->SetDisplayMode($zoom = 'fullpage', $layout = 'TwoColumnRight', $mode = 'UseNone'); // set pdf viewer preferences $pdf->setViewerPreferences(array('Duplex' => 'DuplexFlipLongEdge')); // set booklet mode $pdf->SetBooklet(true, 10, 30); // set core font $pdf->SetFont('helvetica', '', 18); // add a page (left page) $pdf->AddPage(); $pdf->Write(0, 'Example of booklet mode', '', 0, 'L', true, 0, false, false, 0); // print a line using Cell() $pdf->Cell(0, 0, 'PAGE 1', 1, 1, 'C'); // add a page (right page) $pdf->AddPage(); // print a line using Cell() $pdf->Cell(0, 0, 'PAGE 2', 1, 1, 'C'); // add a page (left page) $pdf->AddPage(); // print a line using Cell() $pdf->Cell(0, 0, 'PAGE 3', 1, 1, 'C'); // add a page (right page) $pdf->AddPage(); // print a line using Cell() $pdf->Cell(0, 0, 'PAGE 4', 1, 1, 'C'); $this->comparePdfs($pdf); }
/** * Adds to the TCPDF instance, the data related to a row in the GIS dataset. * * @param string $spatial GIS POINT object * @param string $label Label for the GIS POINT object * @param string $point_color Color for the GIS POINT object * @param array $scale_data Array containing data related to scaling * @param TCPDF $pdf TCPDF instance * * @return TCPDF the modified TCPDF instance * @access public */ public function prepareRowAsPdf($spatial, $label, $point_color, $scale_data, $pdf) { // allocate colors $red = hexdec(mb_substr($point_color, 1, 2)); $green = hexdec(mb_substr($point_color, 3, 2)); $blue = hexdec(mb_substr($point_color, 4, 2)); $line = array('width' => 1.25, 'color' => array($red, $green, $blue)); // Trim to remove leading 'POINT(' and trailing ')' $point = mb_substr($spatial, 6, mb_strlen($spatial) - 7); $points_arr = $this->extractPoints($point, $scale_data); // draw a small circle to mark the point if ($points_arr[0][0] != '' && $points_arr[0][1] != '') { $pdf->Circle($points_arr[0][0], $points_arr[0][1], 2, 0, 360, 'D', $line); // print label if applicable if (isset($label) && trim($label) != '') { $pdf->SetXY($points_arr[0][0], $points_arr[0][1]); $pdf->SetFontSize(5); $pdf->Cell(0, 0, trim($label)); } } return $pdf; }
public function testPdfOutput() { // create new PDF document $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); // set document information $pdf->SetCreator(PDF_CREATOR); $pdf->SetAuthor('Nicola Asuni'); $pdf->SetTitle('TCPDF Example 055'); $pdf->SetSubject('TCPDF Tutorial'); $pdf->SetKeywords('TCPDF, PDF, example, test, guide'); // set default header data $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE . ' 055', 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 (optional) $pdf->setLanguageArray($this->langSettings); // --------------------------------------------------------- // set font $pdf->SetFont('helvetica', '', 14); // array of font names $core_fonts = array('courier', 'courierB', 'courierI', 'courierBI', 'helvetica', 'helveticaB', 'helveticaI', 'helveticaBI', 'times', 'timesB', 'timesI', 'timesBI', 'symbol', 'zapfdingbats'); // set fill color $pdf->SetFillColor(221, 238, 255); // create one HTML table for each core font foreach ($core_fonts as $font) { // add a page $pdf->AddPage(); // Cell($w, $h=0, $txt='', $border=0, $ln=0, $align='', $fill=false, $link='', $stretch=0, $ignore_min_height=false, $calign='T', $valign='M') // set font for title $pdf->SetFont('helvetica', 'B', 16); // print font name $pdf->Cell(0, 10, 'FONT: ' . $font, 1, 1, 'C', true, '', 0, false, 'T', 'M'); // set font for chars $pdf->SetFont($font, '', 16); // print each character for ($i = 0; $i < 256; ++$i) { if ($i > 0 and $i % 16 == 0) { $pdf->Ln(); } $pdf->Cell(11.25, 11.25, TCPDF_FONTS::unichr($i), 1, 0, 'C', false, '', 0, false, 'T', 'M'); } $pdf->Ln(20); // print a pangram $pdf->Cell(0, 0, 'The quick brown fox jumps over the lazy dog', 0, 1, 'C', false, '', 0, false, 'T', 'M'); } // --------------------------------------------------------- $this->comparePdfs($pdf); }
function index() { $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); // 设置文档的基本信息 $pdf->SetCreator(PDF_CREATOR); $pdf->SetAuthor('tongji'); $pdf->SetTitle('下载'); $pdf->SetSubject('打印文档'); $pdf->SetKeywords('下载, 打印文档'); // 默认页眉页脚 $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE . ' 023', PDF_HEADER_STRING); // 页眉页脚字体 $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); // 默认等宽字体 $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); // 间距设置 $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); $pdf->SetHeaderMargin(PDF_MARGIN_HEADER); $pdf->SetFooterMargin(PDF_MARGIN_FOOTER); // 自动分页 $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); // 图像缩放因子 $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); // --------------------------------------------------------- // 设置中文字体 $pdf->SetFont('droidsansfallback', 'BI', 14); // Start First Page Group $pdf->startPageGroup(); // add a page $pdf->AddPage(); // set some text to print $txt = <<<EOD Example of page groups. Check the page numbers on the page footer. This is the first page of group 1. EOD; // print a block of text using Write() $pdf->Write(0, $txt, '', 0, 'L', true, 0, false, false, 0); // add second page $pdf->AddPage(); $pdf->Cell(0, 10, '发热551', 0, 1, 'L'); // --------------------------------------------------------- //Bug出现下载文档 //Close and output PDF document $pdf->Output('example_023.pdf', 'I'); }