/**
  * Writes text at the specified x and y coordinates
  *
  * See {@link Style::munge_color()} for the format of the color array.
  *
  * @param float $x
  * @param float $y
  * @param string $text the text to write
  * @param string $font the font file to use
  * @param float $size the font size, in points
  * @param array $color
  * @param float $adjust word spacing adjustment
  */
 function text($x, $y, $text, $font, $size, $color = array(0, 0, 0), $adjust = 0, $angle = 0, $blend = "Normal", $opacity = 1.0)
 {
     dompdf_debug("trace", "({$x}, {$y}, {$text}, " . basename($font) . ", {$size}, [{$color['0']}, {$color['1']}, {$color['2']}], {$adjust}, {$angle}, {$blend}, {$opacity})");
     list($r, $g, $b) = $this->_get_rgb($color);
     $this->_pdf->SetTextColor($r, $g, $b);
     $this->_set_line_transparency($blend, $opacity);
     $this->_set_fill_transparency($blend, $opacity);
     $fontdata = $this->_get_font($font);
     $this->_pdf->SetFont($fontdata['family'], $fontdata['style'], $size, $font);
     //$this->_pdf->SetFontSize($size);
     // ???
     if ($adjust > 0) {
         $a = explode(' ', $text);
         //$this->_pdf->SetXY($x - 3, $y + (self::FONT_HEIGHT_SCALE - 1) * $size);
         $this->_pdf->SetXY($x, $y);
         //$y += self::FONT_HEIGHT_SCALE * $size + 1;
         for ($i = 0; $i < count($a) - 1; $i++) {
             $this->_pdf->Write($size, $a[$i] . ' ', '');
             //$this->_pdf->Text($x, $y, $a[$i].' ');
             $this->_pdf->SetX($this->_pdf->GetX() + $adjust);
             //$x += $this->_pdf->GetX() + $adjust;
         }
         $this->_pdf->Write($size, $a[$i], '');
         //$this->_pdf->Text($x, $y, $a[$i].' ');
     } else {
         if ($angle != 0) {
             $this->_pdf->StartTransform();
             //$y += self::FONT_HEIGHT_SCALE * $size;
             //$y += $size;
             $this->_pdf->Rotate(-$angle, $x, $y);
             $this->_pdf->Text($x, $y, $text, false, false, true, 0, 0, '', 0, '', 0, false, 'T', 'T');
             $this->_pdf->StopTransform();
         } else {
             //$pippo = $this->_pdf->getFontAscent($fontdata['family'], $fontdata['style'], $size);
             //$y += $pippo / 8;
             //$y = $y - 0.85 * $size;	// + 0.8 * $size;
             $this->_pdf->Text($x, $y, $text, false, false, true, 0, 0, '', 0, '', 0, false, 'T', 'T');
         }
     }
 }
Example #2
2
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>&nbsp;</p>

<p>Student: <?php 
    echo "{$ime} {$prezime} ({$brindexa})";
    ?>
</p>

<p>&nbsp;</p>

<p><b>Predmet: ZAHTJEV ZA KOLIZIJU</b></p>

<p>&nbsp;</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>&nbsp;</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>&nbsp;</p>

<p>U nadi da ćete udovoljiti mom zahtjevu,</p>

<p>&nbsp;</p>

<table border="0"><tr><td width="100%">&nbsp;</td><td align="right"><p>&nbsp;</p><p>_____________________________________</p></td></tr>
<tr><td width="100%">&nbsp;</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
    //============================================================+
}
Example #3
2
 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 009');
     $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 . ' 009', 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);
     // -------------------------------------------------------------------
     // add a page
     $pdf->AddPage();
     // set JPEG quality
     $pdf->setJPEGQuality(75);
     // Image method signature:
     // Image($file, $x='', $y='', $w=0, $h=0, $type='', $link='', $align='', $resize=false, $dpi=300, $palign='', $ismask=false, $imgmask=false, $border=0, $fitbox=false, $hidden=false, $fitonpage=false)
     // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     // Example of Image from data stream ('PHP rules')
     $imgdata = base64_decode('iVBORw0KGgoAAAANSUhEUgAAABwAAAASCAMAAAB/2U7WAAAABlBMVEUAAAD///+l2Z/dAAAASUlEQVR4XqWQUQoAIAxC2/0vXZDrEX4IJTRkb7lobNUStXsB0jIXIAMSsQnWlsV+wULF4Avk9fLq2r8a5HSE35Q3eO2XP1A1wQkZSgETvDtKdQAAAABJRU5ErkJggg==');
     // The '@' character is used to indicate that follows an image data stream and not an image file name
     $pdf->Image('@' . $imgdata);
     // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     // Image example with resizing
     $pdf->Image('./tests/images/image_demo.jpg', 15, 140, 75, 113, 'JPG', 'http://www.tcpdf.org', '', true, 150, '', false, false, 1, false, false, false);
     // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     // test fitbox with all alignment combinations
     $horizontal_alignments = array('L', 'C', 'R');
     $vertical_alignments = array('T', 'M', 'B');
     $x = 15;
     $y = 35;
     $w = 30;
     $h = 30;
     // test all combinations of alignments
     for ($i = 0; $i < 3; ++$i) {
         $fitbox = $horizontal_alignments[$i] . ' ';
         $x = 15;
         for ($j = 0; $j < 3; ++$j) {
             $fitbox[1] = $vertical_alignments[$j];
             $pdf->Rect($x, $y, $w, $h, 'F', array(), array(128, 255, 128));
             $pdf->Image('./tests/images/image_demo.jpg', $x, $y, $w, $h, 'JPG', '', '', false, 300, '', false, false, 0, $fitbox, false, false);
             $x += 32;
             // new column
         }
         $y += 32;
         // new row
     }
     $x = 115;
     $y = 35;
     $w = 25;
     $h = 50;
     for ($i = 0; $i < 3; ++$i) {
         $fitbox = $horizontal_alignments[$i] . ' ';
         $x = 115;
         for ($j = 0; $j < 3; ++$j) {
             $fitbox[1] = $vertical_alignments[$j];
             $pdf->Rect($x, $y, $w, $h, 'F', array(), array(128, 255, 255));
             $pdf->Image('./tests/images/image_demo.jpg', $x, $y, $w, $h, 'JPG', '', '', false, 300, '', false, false, 0, $fitbox, false, false);
             $x += 27;
             // new column
         }
         $y += 52;
         // new row
     }
     // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     // Stretching, position and alignment example
     $pdf->SetXY(110, 200);
     $pdf->Image('./tests/images/image_demo.jpg', '', '', 40, 40, '', '', 'T', false, 300, '', false, false, 1, false, false, false);
     $pdf->Image('./tests/images/image_demo.jpg', '', '', 40, 40, '', '', '', false, 300, '', false, false, 1, false, false, false);
     $this->comparePdfs($pdf);
 }
Example #4
1
 /**
  * we redifine the original SetXY method, because we don't want the automatic treatment.
  * It is HTML2PDF that make the treatment.
  * If language is RTL direction this method will call to parent (TCPDF class).
  *
  * @param integer $x
  * @param integer $y
  * @param boolean $rtloff
  * @access public
  */
 public function SetXY($x, $y, $rtloff=false)
 {
     if (!$rtloff AND $this->rtl) {
         parent::SetXY($x, $y, $rtloff);
     } else {
         $this->x=$x;
         $this->y=$y;
     }
 }
 /**
  * Adds to the TCPDF instance, the data related to a row in the GIS dataset.
  *
  * @param string $spatial    GIS MULTILINESTRING object
  * @param string $label      Label for the GIS MULTILINESTRING object
  * @param string $line_color Color for the GIS MULTILINESTRING 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, $line_color, $scale_data, $pdf)
 {
     /** @var PMA_String $pmaString */
     $pmaString = $GLOBALS['PMA_String'];
     // allocate colors
     $red = hexdec($pmaString->substr($line_color, 1, 2));
     $green = hexdec($pmaString->substr($line_color, 3, 2));
     $blue = hexdec($pmaString->substr($line_color, 4, 2));
     $line = array('width' => 1.5, 'color' => array($red, $green, $blue));
     // Trim to remove leading 'MULTILINESTRING((' and trailing '))'
     $multilinestirng = $pmaString->substr($spatial, 17, $pmaString->strlen($spatial) - 19);
     // Separate each linestring
     $linestirngs = explode("),(", $multilinestirng);
     $first_line = true;
     foreach ($linestirngs as $linestring) {
         $points_arr = $this->extractPoints($linestring, $scale_data);
         foreach ($points_arr as $point) {
             if (!isset($temp_point)) {
                 $temp_point = $point;
             } else {
                 // draw line section
                 $pdf->Line($temp_point[0], $temp_point[1], $point[0], $point[1], $line);
                 $temp_point = $point;
             }
         }
         unset($temp_point);
         // print label
         if (isset($label) && trim($label) != '' && $first_line) {
             $pdf->SetXY($points_arr[1][0], $points_arr[1][1]);
             $pdf->SetFontSize(5);
             $pdf->Cell(0, 0, trim($label));
         }
         $first_line = false;
     }
     return $pdf;
 }
Example #6
1
function izvjestaj_prijemni_brzi_unos()
{
    require_once 'lib/tcpdf/tcpdf.php';
    $termin = intval($_REQUEST['termin']);
    $osoba = intval($_REQUEST['osoba']);
    $q10 = myquery("select ime, prezime, imeoca, jmbg from osoba where id={$osoba}");
    if (mysql_num_rows($q10) < 1) {
        biguglyerror("Nepostojeća osoba");
        zamgerlog("nepostojeca osoba {$osoba}", 3);
        return;
    }
    $ime = mysql_result($q10, 0, 0);
    $prezime = mysql_result($q10, 0, 1);
    $imeoca = mysql_result($q10, 0, 2);
    $jmbg = mysql_result($q10, 0, 3);
    $q20 = myquery("select sifra, jezik from prijemni_obrazac where osoba={$osoba} and prijemni_termin={$termin}");
    if (mysql_num_rows($q20) < 1) {
        biguglyerror("Ne postoji obrazac za ovu osobu");
        zamgerlog("za osobu u{$osoba} ne postoji obrazac na terminu {$termin}", 3);
        return;
    }
    $sifra = mysql_result($q20, 0, 0);
    $jezik = mysql_result($q20, 0, 1);
    $datum = date("d. m. Y.");
    $vrijeme = date("h:i");
    // ----- 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('Sifra kandidata i pregled vaznijih datuma');
    // 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', '', 48);
    $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);
    if ($jezik == "en") {
        $pdf->Image("images/content/150dpi/obrazac_sa_sifrom_en.png", 0, 0, 210, 0, '', '', '', true, 150);
        $en_offset = 7;
    } else {
        $pdf->Image("images/content/150dpi/obrazac_sa_sifrom.png", 0, 0, 210, 0, '', '', '', true, 150);
        $en_offset = 0;
    }
    $pdf->SetXY(130, 15);
    $pdf->Cell(23, 0, $sifra, 0, 0, 'C');
    $pdf->SetFont('freesans', '', 16);
    $pdf->SetXY(80, 62 + $en_offset);
    $pdf->Cell(23, 0, "{$ime} ({$imeoca}) {$prezime}");
    $pdf->SetXY(80, 73 + $en_offset);
    $pdf->Cell(23, 0, $jmbg);
    $pdf->SetFont('freesans', '', 14);
    $pdf->SetXY(40, 113 + $en_offset);
    $pdf->Cell(23, 0, $datum);
    $pdf->SetXY(130, 113 + $en_offset);
    $pdf->Cell(23, 0, $vrijeme);
    // ---------------------------------------------------------
    //Close and output PDF document
    $pdf->Output('obrazac_sa_sifrom.pdf', 'I');
    //============================================================+
    // END OF FILE
    //============================================================+
}
Example #7
1
 * the same results each time, subject only to the graphics state at 
 * the time it is invoked.
 */
// start a new XObject Template
$template_id = $pdf->startTemplate(60, 60);
// create Template content
// ...................................................................
//Start Graphic Transformation
$pdf->StartTransform();
// set clipping mask
$pdf->StarPolygon(30, 30, 29, 10, 3, 0, 1, 'CNZ');
// draw jpeg image to be clipped
//$pdf->Image('../images/image_demo.jpg', 0, 0, 60, 60, '', '', '', true, 72, '', false, false, 0, false, false, false);
//Stop Graphic Transformation
$pdf->StopTransform();
$pdf->SetXY(0, 0);
$pdf->SetFont('times', '', 40);
$pdf->SetTextColor(255, 0, 0);
// print a text
$pdf->Cell(60, 60, 'Template', 0, 0, 'C', false, '', 0, false, 'T', 'M');
// ...................................................................
// end the current Template
$pdf->endTemplate();
// print the selected Template various times
$pdf->printTemplate($template_id, 15, 50, 20, 20, '', '', false);
$pdf->printTemplate($template_id, 27, 62, 40, 40, '', '', false);
$pdf->printTemplate($template_id, 55, 85, 60, 60, '', '', false);
$pdf->printTemplate($template_id, 95, 125, 80, 80, '', '', false);
// ---------------------------------------------------------
//Close and output PDF document
$pdf->Output('example_062.pdf', 'I');
 /**
  * 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;
 }
 /**
  * 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;
 }
Example #10
1
	if($plbcode=='Y') $lheight+=10;
*/
$q = mysql_query("SELECT * FROM `p_label`");
$k = 0;
$kol = 0;
$row = 0;
$i = 0;
$nkol = floor($dcPageW / ($lwidth + 1));
$nrow = 99;
//$nrow=floor($dcPageH/$lheight);
while ($r = mysql_fetch_array($q)) {
    $b = dbSFA("*", "book", "W/dcid='" . $r['book'] . "'");
    // Print Label >>
    $x = ($lwidth + 1) * $kol + $dcMarginL;
    $y = $lheight * $row + $dcMarginT;
    $pdf->SetXY($x, $y);
    $pl = false;
    if ($plhead == 'Y') {
        $pl = true;
        $pdf->setCellPaddings(0, 0.5, 0, 0);
        $pdf->SetFont('dejavusans', '', 10, '', true);
        $pdf->MultiCell($lwidth, 0, $title, 'LTR', 'C', 0, 1, '', '', true);
        if ($k == 0) {
            $lheight += $pdf->getLastH();
        }
        $pdf->SetX($x);
        $pdf->setCellPaddings(0, 0, 0, 0.5);
        $pdf->SetFont('dejavusans', '', 7, '', true);
        $pdf->MultiCell($lwidth, 0, $desc, 'LBR', 'C', 0, 9, '', '', true);
        if ($k == 0) {
            $lheight += $pdf->getLastH();
Example #11
0
 /**
  * [พิมพ์ post]
  * @param  [type] $id [description]
  * @return [type]     [description]
  */
 public function printPost($id)
 {
     if (Session::get('c3') == 1) {
         $sql = ' select c.*, concat(n.pname,n.fname," ",n.lname) as fullname from c_blog_posts c left join n_datageneral n on n.cid=c.created_by';
         $sql .= ' where postID =' . e($id) . ' ';
         $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
         $pdf->SetPrintHeader(false);
         $pdf->SetPrintFooter(false);
         // set header and footer fonts
         $pdf->setHeaderFont(array('angsanaupc', '', PDF_FONT_SIZE_MAIN));
         $pdf->setFooterFont(array('angsanaupc', '', PDF_FONT_SIZE_DATA));
         // set default monospaced font
         $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
         // set margins
         $pdf->SetMargins(15, 15, 15);
         $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
         $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
         $pdf->AddPage();
         $pdf->SetFont('angsanaupc', 'B', 16, '', true);
         $pdf->SetXY(15, 15);
         $pdf->MultiCell(180, 0, 'ใบประสานงานขอรถ', 0, 'C', 0, 1, '', '', true);
         $data = DB::select($sql);
         $pdf->SetFont('angsanaupc', '', 14, '', true);
         $tbl = '<br /><br /><table style="width: 100%; padding:2px;" cellspacing="0">';
         foreach ($data as $key => $value) {
             $tbl = $tbl . '<tr>
                   <td style="border: 0px solid #000000; text-align:left"> เรื่อง ' . $value->postTitle . '</td>
               </tr>';
             $tbl = $tbl . '<tr>
                   <td style="border: 0px solid #000000; text-align:left"> สร้างโดย ' . $value->fullname . ' วันที่ ' . date("d-m", strtotime($value->postDate)) . '-' . (date("Y", strtotime($value->postDate)) + 543) . ' เวลา ' . date("H:i:s", strtotime($value->postDate)) . '</td>
               </tr>';
             $tbl = $tbl . '<tr>
                   <td style="border: 0px solid #000000; text-align:left"> ' . $value->postDesc . '</td>
               </tr>';
         }
         $tbl = $tbl . '</table>';
         $pdf->writeHTML($tbl, true, false, false, false, '');
         $filename = storage_path() . '/report_post.pdf';
         $contents = $pdf->output($filename, 'I');
         $headers = array('Content-Type' => 'application/pdf');
         return Response::make($contents, 200, $headers);
     } else {
         return Redirect::to('contact');
     }
 }
Example #12
0
    public function generateJobOrderReportPDF()
    {
        /* E_STRICT doesn't like FPDF. */
        $errorReporting = error_reporting();
        error_reporting($errorReporting & ~ E_STRICT);
        include_once('./lib/fpdf/fpdf.php');
        error_reporting($errorReporting);

        // FIXME: Hook?
        $isASP = $_SESSION['CATS']->isASP();

        $unixName = $_SESSION['CATS']->getUnixName();

        $siteName       = $this->getTrimmedInput('siteName', $_GET);
        $companyName    = $this->getTrimmedInput('companyName', $_GET);
        $jobOrderName   = $this->getTrimmedInput('jobOrderName', $_GET);
        $periodLine     = $this->getTrimmedInput('periodLine', $_GET);
        $accountManager = $this->getTrimmedInput('accountManager', $_GET);
        $recruiter      = $this->getTrimmedInput('recruiter', $_GET);
        $notes          = $this->getTrimmedInput('notes', $_GET);

        if (isset($_GET['dataSet']))
        {
            $dataSet = $_GET['dataSet'];
            $dataSet = explode(',', $dataSet);
        }
        else
        {
            $dataSet = array(4, 3, 2, 1);
        }


        /* PDF Font Face. */
        // FIXME: Customizable.
        $fontFace = 'helvetica';
        $pdf=new \TCPDF();
        //$pdf = new FPDF();
        $pdf->AddPage();

        if (!eval(Hooks::get('REPORTS_CUSTOMIZE_JO_REPORT_PRE'))) return;
        $pdf->SetFont($fontFace, 'B', 10);
        if ($isASP && $unixName == 'cognizo')
        {
            /* TODO: MAKE THIS CUSTOMIZABLE FOR EVERYONE. */
            
            $pdf->Image('images/cognizo-logo.jpg', 130, 10, 59, 20);
            $pdf->SetXY(129,27);
            $pdf->Write(5, 'Information Technology Consulting');
        }

        $pdf->SetXY(25, 35);
        $pdf->SetFont($fontFace, 'BU', 14);
        $pdf->Write(5, "Recruiting Summary Report\n");

        $pdf->SetFont($fontFace, '', 10);
        $pdf->SetX(25);
        $pdf->Write(5, DateUtility::getAdjustedDate('l, F d, Y') . "\n\n\n");

        $pdf->SetFont($fontFace, 'B', 10);
        $pdf->SetX(25);
        $pdf->Write(5, 'Company: '. $companyName . "\n");

        $pdf->SetFont($fontFace, '', 10);
        $pdf->SetX(25);
        $pdf->Write(5, 'Position: ' . $jobOrderName . "\n\n");

        $pdf->SetFont($fontFace, '', 10);
        $pdf->SetX(25);
        $pdf->Write(5, 'Period: ' . $periodLine . "\n\n");

        $pdf->SetFont($fontFace, '', 10);
        $pdf->SetX(25);
        $pdf->Write(5, 'Account Manager: ' . $accountManager . "\n");

        $pdf->SetFont($fontFace, '', 10);
        $pdf->SetX(25);
        $pdf->Write(5, 'Recruiter: ' . $recruiter . "\n");

        /* Note that the server is not logged in when getting this file from
         * itself.
         */
        // FIXME: Pass session cookie in URL? Use cURL and send a cookie? I
        //        really don't like this... There has to be a way.
        // FIXME: "could not make seekable" - http://demo.catsone.net/index.php?m=graphs&a=jobOrderReportGraph&data=%2C%2C%2C
        //        in /usr/local/www/catsone.net/data/lib/fpdf/fpdf.php on line 1500
        $URI = CATSUtility::getAbsoluteURI(
            CATSUtility::getIndexName()
            . '?m=graphs&a=jobOrderReportGraph&data='
            . urlencode(implode(',', $dataSet))
        );

        $pdf->Image($URI, 70, 95, 80, 80, 'jpg');

        $pdf->SetXY(25,180);
        $pdf->SetFont($fontFace, '', 10);
        $pdf->Write(5, 'Total Candidates ');
        $pdf->SetTextColor(255, 0, 0);
        $pdf->Write(5, 'Screened');
        $pdf->SetTextColor(0, 0, 0);
        $pdf->Write(5, ' by ' . $siteName . ": \n\n");

        $pdf->SetX(25);
        $pdf->SetFont($fontFace, '', 10);
        $pdf->Write(5, 'Total Candidates ');
        $pdf->SetTextColor(0, 125, 0);
        $pdf->Write(5, 'Submitted');
        $pdf->SetTextColor(0, 0, 0);
        $pdf->Write(5, ' to ' . $companyName . ": \n\n");

        $pdf->SetX(25);
        $pdf->SetFont($fontFace, '', 10);
        $pdf->Write(5, 'Total Candidates ');
        $pdf->SetTextColor(0, 0, 255);
        $pdf->Write(5, 'Interviewed');
        $pdf->SetTextColor(0, 0, 0);
        $pdf->Write(5, ' by ' . $companyName . ": \n\n");

        $pdf->SetX(25);
        $pdf->SetFont($fontFace, '', 10);
        $pdf->Write(5, 'Total Candidates ');
        $pdf->SetTextColor(255, 75, 0);
        $pdf->Write(5, 'Placed');
        $pdf->SetTextColor(0, 0, 0);
        $pdf->Write(5, ' at ' . $companyName . ": \n\n\n");

        if ($notes != '')
        {
            $pdf->SetX(25);
            $pdf->SetFont($fontFace, '', 10);
            $pdf->Write(5, "Notes:\n");

            $len = strlen($notes);
            $maxChars = 70;

            $pdf->SetLeftMargin(25);
            $pdf->SetRightMargin(25);
            $pdf->SetX(25);
            $pdf->Write(5, $notes . "\n");
        }

        $pdf->SetXY(165, 180);
        $pdf->SetFont($fontFace, 'B', 10);
        $pdf->Write(5, $dataSet[0] . "\n\n");
        $pdf->SetX(165);
        $pdf->Write(5, $dataSet[1] . "\n\n");
        $pdf->SetX(165);
        $pdf->Write(5, $dataSet[2] . "\n\n");
        $pdf->SetX(165);
        $pdf->Write(5, $dataSet[3] . "\n\n");

        $pdf->Rect(3, 6, 204, 285);

        if (!eval(Hooks::get('REPORTS_CUSTOMIZE_JO_REPORT_POST'))) return;

        $pdf->Output();
        die();
    }
Example #13
0
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
//set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
//set some language-dependent strings
$pdf->setLanguageArray($l);
// ---------------------------------------------------------
// NOTE: 2D barcode algorithms must be implemented on 2dbarcode.php class file.
// set font
$pdf->SetFont('helvetica', '', 10);
// add a page
$pdf->AddPage();
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// set style for barcode
$style = array('border' => true, 'vpadding' => 'auto', 'hpadding' => 'auto', 'fgcolor' => array(0, 0, 0), 'bgcolor' => false, 'module_width' => 1, 'module_height' => 1);
// write RAW 2D Barcode
$pdf->SetXY(30, 30);
$code = '111011101110111,010010001000010,010011001110010,010010000010010,010011101110010';
$pdf->write2DBarcode($code, 'RAW', '', '', 30, 20, $style, 'N');
$pdf->SetXY(100, 30);
// write RAW2 2D Barcode
$code = '[111011101110111][010010001000010][010011001110010][010010000010010][010011101110010]';
$pdf->write2DBarcode($code, 'RAW2', '', '', 30, 20, $style, 'N');
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// set style for barcode
$style = array('border' => 2, 'vpadding' => 'auto', 'hpadding' => 'auto', 'fgcolor' => array(0, 0, 0), 'bgcolor' => false, 'module_width' => 1, 'module_height' => 1);
// QRCODE,L : QR-CODE Low error correction
$pdf->SetXY(30, 60);
$pdf->write2DBarcode('www.tcpdf.org', 'QRCODE,L', '', '', 50, 50, $style, 'N');
$pdf->Text(30, 55, 'QRCODE L');
// QRCODE,M : QR-CODE Medium error correction
$pdf->SetXY(100, 60);
Example #14
0
Fusce et felis vitae diam lobortis sollicitudin. Aenean tincidunt accumsan nisi, id vehicula quam laoreet elementum. Phasellus egestas interdum erat, et viverra ipsum ultricies ac. Praesent sagittis augue at augue volutpat eleifend. Cras nec orci neque. Mauris bibendum posuere blandit. Donec feugiat mollis dui sit amet pellentesque. Sed a enim justo. Donec tincidunt, nisl eget elementum aliquam, odio ipsum ultrices quam, eu porttitor ligula urna at lorem. Donec varius, eros et convallis laoreet, ligula tellus consequat felis, ut ornare metus tellus sodales velit. Duis sed diam ante. Ut rutrum malesuada massa, vitae consectetur ipsum rhoncus sed. Suspendisse potenti. Pellentesque a congue massa.
Integer non sem eget neque mattis accumsan. Maecenas eu nisl mauris, sit amet interdum ipsum. In pharetra erat vel lectus venenatis elementum. Nulla non elit ligula, sit amet mollis urna. Morbi ut gravida est. Mauris tincidunt sem et turpis molestie malesuada. Curabitur vel nulla risus, sed mollis erat. Suspendisse vehicula accumsan purus nec varius. Donec fermentum lorem id felis sodales dictum. Quisque et dolor ipsum. Nam luctus consectetur dui vitae fermentum. Curabitur sodales consequat augue, id ultricies augue tempor ac. Aliquam ac magna id ipsum vehicula bibendum. Sed elementum congue tristique. <img src="../images/image_demo.jpg" width="5mm" height="5mm" /> Phasellus vel lorem eu lectus porta sodales. Etiam neque tortor, sagittis id pharetra quis, laoreet vel arcu.
Cras quam mi, ornare laoreet laoreet vel, vehicula at lacus. Maecenas a lacus accumsan augue convallis sagittis sed quis odio. Morbi sit amet turpis diam, dictum convallis urna. Cras eget interdum augue. Cras eu nisi sit amet dolor faucibus porttitor. Suspendisse potenti. Nunc vitae dolor risus, at cursus libero. Suspendisse bibendum tellus non nibh hendrerit tristique. Mauris eget orci elit. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam porta libero non ante laoreet semper. Proin volutpat sodales mi, ac fermentum erat sagittis in. Vivamus at viverra felis. Ut pretium facilisis ante et pharetra.
Nulla facilisi. Cras varius quam eget libero aliquam vitae tincidunt leo rutrum. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Pellentesque a nisl massa, quis pretium urna. Proin vel porttitor tortor. Cras rhoncus congue velit in bibendum. Donec pharetra semper augue id lacinia. Quisque magna quam, hendrerit eu aliquam et, pellentesque ut tellus. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Maecenas nulla quam, rutrum eu feugiat at, elementum eu libero. Maecenas ullamcorper leo et turpis rutrum ac laoreet eros faucibus. Phasellus condimentum lorem quis neque imperdiet quis molestie enim iaculis. Phasellus risus est, vestibulum ut convallis ultrices, dignissim nec erat. Etiam congue lobortis laoreet. Nulla ut neque sed velit dapibus semper. Quisque nec dolor id nibh eleifend iaculis. Vivamus vitae fermentum odio. Etiam malesuada quam in nulla aliquam sed convallis dui feugiat.</p>';
// add a page
$pdf->AddPage();
// print some graphic content
$pdf->Image('../images/image_demo.jpg', 155, 30, 40, 40, 'JPG', '', '', true);
$pdf->Image('../images/image_demo.jpg', 15, 230, 40, 40, 'JPG', '', '', true);
// define some graphic styles
$styleA = array('width' => 0.254, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(255, 0, 0));
$styleB = array('width' => 0.254, 'cap' => 'butt', 'join' => 'miter', 'dash' => 3, 'color' => array(127, 127, 127));
$pdf->SetFillColor(220, 255, 220);
// write a trapezoid with some information about no-write page regions
$pdf->Polygon(array(15, 90, 57, 90, 67, 140, 15, 140), 'DF', array($styleB, $styleA, $styleB, $styleB));
$pdf->SetXY(15, 90);
$pdf->Cell(42, 0, 'xt,yt', 0, 0, 'R', false, '', 0, false, 'T', 'T');
$pdf->SetXY(15, 140);
$pdf->Cell(52, 0, 'xb,yb', 0, 0, 'R', false, '', 0, false, 'B', 'B');
$pdf->SetXY(15, 115);
$pdf->Cell(40, 0, 'side', 0, 0, 'R', false, '', 0, false, 'B', 'B');
$pdf->SetLineStyle(array('width' => 0.254, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0)));
$pdf->Arrow(60, 115, 35, 115, 2, 5, 15);
// write a trapezoid with some information about no-write page regions
$pdf->Polygon(array(145, 130, 195, 130, 195, 180, 155, 180), 'DF', array($styleB, $styleB, $styleB, $styleA));
$pdf->SetXY(145, 130);
$pdf->Cell(42, 0, 'xt,yt', 0, 0, 'L', false, '', 0, false, 'T', 'T');
$pdf->SetXY(155, 180);
$pdf->Cell(52, 0, 'xb,yb', 0, 0, 'L', false, '', 0, false, 'B', 'B');
$pdf->SetXY(160, 155);
$pdf->Cell(30, 0, 'side', 0, 0, 'L', false, '', 0, false, 'B', 'B');
Example #15
0
/*
if($plhead=='Y') $lheight+=9;
	if($plcnum=='Y') $lheight+=14;
	if($plbcode=='Y') $lheight+=10;
*/

$q=mysql_query("SELECT * FROM `pus_tpjm` WHERE ssid='$ssid'"); $k=0;
//$pdf->MultiCell(100, 0, mysql_num_rows($q), 'LTRB', 'C', 0, 1, '', '', true);
$kol=0; $row=0; $i=0; $nkol=floor($dcPageW/($lwidth+1)); $nrow=99; //$nrow=floor($dcPageH/$lheight);
while($r=mysql_fetch_array($q)){
	$t01=mysql_query("SELECT pus_buku.replid,pus_buku.idbuku,pus_buku.barkode,pus_katalog.callnumber FROM pus_buku LEFT JOIN pus_katalog ON pus_katalog.replid=pus_buku.katalog WHERE pus_buku.replid='".$r['buku']."' LIMIT 0,1");
	$b=mysql_fetch_array($t01);
	//$b=dbSFA("*","pus_buku","W/replid='".$r['buku']."'");
	// Print Label >>
	$x=($lwidth+1)*$kol+$dcMarginL; $y=$lheight*$row+$dcMarginT;
	$pdf->SetXY($x,$y); $pl=false;
	if($plhead=='1'){ $pl=true;
	$pdf->setCellPaddings(0, 0.5, 0, 0);
	$pdf->SetFont('dejavusans', '', 10, '', true);
	$pdf->MultiCell($lwidth, 0, $title, 'LTR', 'C', 0, 1, '', '', true);
	if($k==0) $lheight+=$pdf->getLastH();	
	$pdf->SetX($x);
	$pdf->setCellPaddings(0, 0, 0, 0.5);
	$pdf->SetFont('dejavusans', '', 7, '', true);
	$pdf->MultiCell($lwidth, 0, $desc, 'LBR', 'C', 0, 9, '', '', true);
	if($k==0) $lheight+=$pdf->getLastH();	
	}
	if($plcnum=='1'){ $pl=true;
	//dc_YDown(1);
	$pdf->SetX($x);
	$pdf->setCellPaddings(0,0.5,0,0.5);
Example #16
0
 $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('L', 'A3');
 $sliders = getSliders();
 $notes = getNotes();
 $pdf->SetXY(10, 40);
 foreach ($sliders as $slider) {
     if ($slider["title"] === "&Iacute;ndice general de la construcci&oacute;n") {
         $gallery = getSliderGallery($slider["id_slider"]);
         if ($gallery) {
             $filename = generateRandomString();
             file_put_contents("_temp/" . $filename . getExtension($gallery[0]["type_image"]), $gallery[0]["slider_image"]);
             $pdf->Image("_temp/" . $filename . getExtension($gallery[0]["type_image"]), 20, 30);
         }
     }
 }
 $pdf->SetFont('helvetica', '', 9, '', true);
 $pdf->SetXY(10, 150);
 foreach ($notes as $note) {
     if ($note["note"] === "Nota del &Iacute;ndice General de la Construcci&oacute;n (PRIVADO)") {
         $pdf->SetY(80);
Example #17
0
    require_once dirname(__FILE__) . '/lang/eng.php';
    $pdf->setLanguageArray($l);
}
// ---------------------------------------------------------
// set font
$pdf->SetFont('helvetica', 'B', 20);
// add a page
$pdf->AddPage();
$pdf->Write(0, 'Example of alignment options for Cell()', '', 0, 'L', true, 0, false, false, 0);
$pdf->SetFont('helvetica', '', 11);
// set border width
$pdf->SetLineWidth(0.7);
// set color for cell border
$pdf->SetDrawColor(0, 128, 255);
$pdf->setCellHeightRatio(3);
$pdf->SetXY(15, 60);
// text on center
$pdf->Cell(30, 0, 'Top-Center', 1, $ln = 0, 'C', 0, '', 0, false, 'T', 'C');
$pdf->Cell(30, 0, 'Center-Center', 1, $ln = 0, 'C', 0, '', 0, false, 'C', 'C');
$pdf->Cell(30, 0, 'Bottom-Center', 1, $ln = 0, 'C', 0, '', 0, false, 'B', 'C');
$pdf->Cell(30, 0, 'Ascent-Center', 1, $ln = 0, 'C', 0, '', 0, false, 'A', 'C');
$pdf->Cell(30, 0, 'Baseline-Center', 1, $ln = 0, 'C', 0, '', 0, false, 'L', 'C');
$pdf->Cell(30, 0, 'Descent-Center', 1, $ln = 0, 'C', 0, '', 0, false, 'D', 'C');
$pdf->SetXY(15, 90);
// text on top
$pdf->Cell(30, 0, 'Top-Top', 1, $ln = 0, 'C', 0, '', 0, false, 'T', 'T');
$pdf->Cell(30, 0, 'Center-Top', 1, $ln = 0, 'C', 0, '', 0, false, 'C', 'T');
$pdf->Cell(30, 0, 'Bottom-Top', 1, $ln = 0, 'C', 0, '', 0, false, 'B', 'T');
$pdf->Cell(30, 0, 'Ascent-Top', 1, $ln = 0, 'C', 0, '', 0, false, 'A', 'T');
$pdf->Cell(30, 0, 'Baseline-Top', 1, $ln = 0, 'C', 0, '', 0, false, 'L', 'T');
$pdf->Cell(30, 0, 'Descent-Top', 1, $ln = 0, 'C', 0, '', 0, false, 'D', 'T');
Example #18
0
$style = array('border' => false, 'text' => false, 'stretch' => true, 'hpadding' => $paddingSide);
$iStartNo = (int) $startno;
// Define the "boxes" that the letters and numbers will be printed in
$iBoxes = $tape == 'dlt' ? 6 : 7;
$wBox = ($wLabel - 2 * $radius) / $iBoxes;
$hBox = $hLabel - $hBarcode - $paddingTop;
// The text can be larger when the text orientation is vertical
$fontSize = ($hBox - 2) / 25.4 * 72;
$pdf->SetFont('helvetica', 'B');
for ($c = 0; $c < $cols; $c++) {
    $pdf->setPage(1);
    for ($r = 0; $r < $rows; $r++) {
        // Calculate the correct position on the page, and move to it
        $posX = $marginPageLeft + $c * ($spacingCol + $wLabel);
        $posY = $marginPageTop + $r * ($spacingRow + $hLabel);
        $pdf->SetXY($posX, $posY);
        // Truncate text to maximum allowed
        $txt = $prefix . sprintf("%0" . strlen($startno) . "d", $iStartNo++);
        $txt = substr($txt, 0, $tape == 'dlt' ? 8 : 6);
        if ($borders) {
            $pdf->RoundedRect($posX, $posY, $wLabel, $hLabel, $radius);
        }
        // Print contents of boxes
        if ($textOrientation == 'vertical') {
            // Set a proper font size
            $pdf->SetFontSize($fontSize * 1.6);
            // begin at bottom left, and start a rotation
            $pdf->SetXY($posX + $radius, $posY + $hLabel);
            $pdf->StartTransform();
            $pdf->Rotate(90);
        } else {
Example #19
0
//set up a page
$pdf->AddPage();
$pdf->SetDisplayMode('real');
$pdf->SetFontSize(8);
// ширина квитанции
$width = 190;
// Высота половинки
$height = 75;
// ширина слушебного поля
$field_width = 80;
// Начальные координаты
$x = 10;
$y = 10;
// Первая рамка
$pdf->SetLineStyle(array('dash' => 2));
$pdf->SetXY($x, $y);
$pdf->Cell($width, $height, '', 1, 0, 'C', 0);
$pdf->SetXY($field_width + $x - 40, $y + 5);
$pdf->Write(5, "Извещение" . PHP_EOL);
$pdf->SetXY($x + 10, $height + $y - 10);
//Some test
$pdf->Write(5, "Кассир" . PHP_EOL);
$pdf->SetXY($field_width, $y);
$pdf->Cell($width - $field_width, $height, '', 'L', 0, 'C', 0);
// Наименование
$x = $field_width;
textfield($pdf, $x + 2, $y + 3, 110, $recipient, '(наименование получателя платежа)');
// Инн получателя
$y += 8;
textfield($pdf, $x + 2, $y + 3, 35, $inn, '(ИНН получателя платежа)');
//  Номер счета получателя
Example #20
0
// 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 default font subsetting mode
$pdf->setFontSubsetting(true);
// set font
$pdf->SetFont('droidsansfallback', '', 12);
// add a page
$pdf->AddPage();
// set color for text
$pdf->SetTextColor(0, 63, 127);
// write the text
$pdf->Write(5, '中文,你支持么。chinese support', '', 0, '', false, 0, false, false, 0);
$pdf->SetXY(40, 40);
$pdf->Image('../images/tcpdf_logo.jpg', '', '', 0, 0, '', '', '', false, 300, '', false, false, 1, false, false, false);
// ---------------------------------------------------------
//Close and output PDF document
$pdf->Output('example_008.pdf', 'I');
//============================================================+
// END OF FILE
//============================================================+
Example #21
0
    <td style="">已收款:¥405.00</td>
    <td style="">应收款:¥0.00</td>
    <td style="">客户签收:</td>
  </tr>
</table>
EOF;
$colophon = <<<EOF
<div style="text-align:center;margin:0;padding:0;font-size:36px;">非常感谢您在步步街 http://www.bubujie.com 购物,我们期待您的再次光临!</div>
EOF;
//============================================================+
// 增加一页
$pdf->AddPage('P', 'A4');
// 附加二维码
$pdf->write2DBarcode('http://www.bubujie.com', 'QRCODE,L', 20, 30, 20, 20, $style, 'N');
// 添加Logo
$pdf->SetXY(13, 10);
$pdf->Image('../images/logo_doc_header.gif', '', '', 72, 16, '', '', '', false, 300, '', false, false, 0, false, false, false);
// 输出正文
$pdf->SetXY(20, 30);
$pdf->writeHTML($html, true, 0, true, 0);
$pdf->SetXY(140, 12);
$pdf->Write(0, '配送单存根联', '', 0, '', true, 0, false, false, 0);
// 输出拔
$pdf->SetXY(20, 130);
$pdf->writeHTML($colophon, true, 0, true, 0);
//============================================================+
$style = array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter', 'dash' => 4, 'color' => array(0, 0, 0));
$pdf->Line(0, 150, 210, 150, $style);
//============================================================+
// 附加二维码
$pdf->write2DBarcode('http://www.bubujie.com', 'QRCODE,L', 20, 180, 20, 20, $style, 'N');
 /**
  * Adds to the TCPDF instance, the data related to a row in the GIS dataset.
  *
  * @param string $spatial    GIS LINESTRING object
  * @param string $label      Label for the GIS LINESTRING object
  * @param string $line_color Color for the GIS LINESTRING 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, $line_color, $scale_data, $pdf)
 {
     /** @var PMA_String $pmaString */
     $pmaString = $GLOBALS['PMA_String'];
     // allocate colors
     $red = hexdec($pmaString->substr($line_color, 1, 2));
     $green = hexdec($pmaString->substr($line_color, 3, 2));
     $blue = hexdec($pmaString->substr($line_color, 4, 2));
     $line = array('width' => 1.5, 'color' => array($red, $green, $blue));
     // Trim to remove leading 'LINESTRING(' and trailing ')'
     $linesrting = $pmaString->substr($spatial, 11, $pmaString->strlen($spatial) - 12);
     $points_arr = $this->extractPoints($linesrting, $scale_data);
     foreach ($points_arr as $point) {
         if (!isset($temp_point)) {
             $temp_point = $point;
         } else {
             // draw line section
             $pdf->Line($temp_point[0], $temp_point[1], $point[0], $point[1], $line);
             $temp_point = $point;
         }
     }
     // print label
     if (isset($label) && trim($label) != '') {
         $pdf->SetXY($points_arr[1][0], $points_arr[1][1]);
         $pdf->SetFontSize(5);
         $pdf->Cell(0, 0, trim($label));
     }
     return $pdf;
 }
 /**
  * 
  * Create a pdf with the labels
  *
  */
 function createPdf()
 {
     global $conf, $mysoc, $db, $langs;
     $langs->load("other");
     require_once DOL_DOCUMENT_ROOT . '/includes/tcpdf/tcpdf.php';
     require_once DOL_DOCUMENT_ROOT . "/product/class/product.class.php";
     require_once DOL_DOCUMENT_ROOT . "/core/lib/product.lib.php";
     $pdf = new TCPDF();
     $pdf->SetFont('dejavusans', '', 10);
     $lab_start = $conf->global->LAB_START;
     if ($conf->global->MAIN_MODULE_LABELPRINT_LABELS_0) {
         $PosY = 5 + floor($lab_start / 3) * 36;
     } else {
         $PosY = 4 + floor($lab_start / 3) * 37;
     }
     //$PosY=3;
     $PosX = 5 + $lab_start % 3 * 70;
     //$PosX=5;
     $Line = 5;
     // define barcode style
     $style = array('position' => '', 'align' => 'C', 'stretch' => false, 'fitwidth' => true, 'cellfitalign' => '', 'border' => false, 'hpadding' => 'auto', 'vpadding' => 'auto', 'fgcolor' => array(0, 0, 0), 'bgcolor' => false, 'text' => true, 'font' => 'helvetica', 'fontsize' => 8, 'stretchtext' => 4);
     //First page
     $pdf->AddPage();
     $sql = "SELECT fk_product, qty, price_level";
     $sql .= " FROM " . MAIN_DB_PREFIX . "labelprint";
     $sql .= " WHERE entity=" . $conf->entity;
     $resql = $db->query($sql);
     if ($resql) {
         $num = $db->num_rows($resql);
         $i = 0;
         while ($i < $num) {
             $objp = $db->fetch_object($resql);
             $product = new Product($db);
             $product->fetch($objp->fk_product);
             $qty = $objp->qty;
             $n = 0;
             while ($n < $qty) {
                 //Position X
                 $PosXLabel = $PosX < 70 ? $PosX : $PosX - 3;
                 //Soc Name
                 $pdf->SetFont('dejavusans', 'B', 10);
                 $pdf->SetXY($PosXLabel, $PosY);
                 $pdf->SetFillColor(230, 230, 230);
                 if ($conf->global->LAB_COMP) {
                     $pdf->MultiCell(65, 5, dol_trunc($mysoc->nom, 25), 0, 'L');
                     $flag = 1;
                 } elseif ($conf->global->LAB_PROD_LABEL) {
                     $pdf->MultiCell(65, 5, dol_trunc($product->libelle, 25), 0, 'L');
                     $flag = 2;
                 } else {
                     $pdf->MultiCell(65, 5, dol_trunc($conf->global->LAB_FREE_TEXT, 25), 0, 'L');
                     $flag = 3;
                 }
                 $pdf->SetFont('dejavusans', '', 10);
                 //Position Y
                 $PosYLabel = $PosY + $Line + 2;
                 //Product label
                 $pdf->SetXY($PosXLabel, $PosYLabel);
                 if ($flag == 1) {
                     if ($conf->global->LAB_PROD_LABEL) {
                         $pdf->Cell(25, 5, dol_trunc($product->libelle, 25), 0, 0, 'L');
                     } else {
                         $pdf->Cell(25, 5, dol_trunc($conf->global->LAB_FREE_TEXT, 25), 0, 0, 'L');
                     }
                 }
                 if ($flag == 2) {
                     $pdf->Cell(25, 5, dol_trunc($conf->global->LAB_FREE_TEXT, 25), 0, 0, 'L');
                 } else {
                     $pdf->Cell(25, 5, "", 0, 0, 'L');
                 }
                 //$pdf->Cell(25,5,dol_trunc($product->libelle,25),0,0,'L');
                 //$pdf->Write($Line,dol_trunc($product->libelle,25));
                 $PosYLabel = $PosYLabel + $Line + 2;
                 $pdf->SetXY($PosXLabel, $PosYLabel);
                 //Barcode
                 if ($conf->barcode->enabled) {
                     $product->fetch_barcode();
                     $pdf->write1DBarcode($product->barcode, $product->barcode_type_code, '', '', 35, 18, 0.4, $style, 'N');
                 }
                 //Price
                 $pdf->SetFont('dejavusans', 'B', 10);
                 if (empty($conf->global->PRODUIT_MULTIPRICES)) {
                     $labelPrice = price($product->price_ttc);
                 } else {
                     $labelPrice = price($product->multiprices_ttc[$objp->price_level]);
                 }
                 $pdf->SetXY($PosXLabel + 38, $PosYLabel);
                 $pdf->Cell(25, 5, $labelPrice, 0, 0, 'R');
                 $PosYLabel = $PosYLabel + $Line + 1;
                 $labelPrice = $langs->trans(currency_name($conf->currency));
                 $pdf->SetXY($PosXLabel + 38, $PosYLabel);
                 $pdf->Cell(25, 5, $labelPrice, 0, 0, 'R');
                 $PosYLabel = $PosYLabel + $Line;
                 if ($conf->global->LAB_WEIGHT) {
                     $labelSet = $product->weight;
                     $labelSet .= " " . measuring_units_string($product->weight_units, "weight");
                 } elseif ($conf->global->LAB_LENGTH) {
                     $labelSet = $product->length;
                     $labelSet .= " " . measuring_units_string($product->length_units, "size");
                 } elseif ($conf->global->LAB_AREA) {
                     $labelSet = $product->surface;
                     $labelSet .= " " . measuring_units_string($product->surface_units, "surface");
                 } elseif ($conf->global->LAB_VOLUME) {
                     $labelSet = $product->volume;
                     $labelSet .= " " . measuring_units_string($product->volume_units, "volume");
                 } elseif ($conf->global->LAB_COUNTRY) {
                     $labelSet = getCountry($product->country_id, '', 0, $langs, 0);
                 }
                 $pdf->SetXY($PosXLabel + 38, $PosYLabel);
                 $pdf->Cell(25, 5, $labelSet, 0, 0, 'R');
                 $pdf->SetAutoPageBreak(false);
                 $PosX = $PosX + 70;
                 if ($PosX >= 200) {
                     $PosX = 5;
                     if ($conf->global->MAIN_MODULE_LABELPRINT_LABELS_0) {
                         $PosY = $PosY + 36;
                     } else {
                         $PosY = $PosY + 37;
                     }
                     if ($PosY >= 265) {
                         if ($conf->global->MAIN_MODULE_LABELPRINT_LABELS_0) {
                             $PosY = 5;
                         } else {
                             $PosY = 4;
                         }
                         $pdf->AddPage();
                     }
                 }
                 $n++;
             }
             $i++;
         }
     }
     ini_set('display_errors', 'Off');
     $buf = $pdf->Output("", "S");
     $len = strlen($buf);
     //$file_temp = ini_get("session.save_path")."/".dol_now().".pdf";
     $file_temp = DOL_DATA_ROOT . "/" . dol_now() . ".pdf";
     $gestor = fopen($file_temp, "w");
     fwrite($gestor, $buf);
     fclose($gestor);
     $url = dol_buildpath("/labelprint/download.php", 1) . "?file=" . $file_temp;
     print "<meta http-equiv='refresh' content='0;url=" . $url . "'>";
 }
Example #24
0
 public function view_reserve($id)
 {
     if (Session::get('level') == '1' || Session::get('level') == '3') {
         $sql = ' select * from c_reserve_cars ';
         $sql .= ' where reserve_id =' . $id . ' ';
         $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
         $pdf->SetPrintHeader(false);
         $pdf->SetPrintFooter(false);
         // set header and footer fonts
         $pdf->setHeaderFont(array('angsanaupc', '', PDF_FONT_SIZE_MAIN));
         $pdf->setFooterFont(array('angsanaupc', '', PDF_FONT_SIZE_DATA));
         // set default monospaced font
         $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
         // set margins
         $pdf->SetMargins(10, 10, 10);
         $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
         $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
         $pdf->SetFont('angsanaupc', '', 14, '', true);
         $pdf->AddPage();
         $pdf->SetXY(10, 10);
         $pdf->Image('images/krut.jpg', '', '', 20, 20, '', '', 'T', false, 300, '', false, false, 0, false, false, false);
         $pdf->SetFont('angsanaupc', 'B', 18, '', true);
         $pdf->SetXY(75, 20);
         $pdf->MultiCell(60, 0, 'บันทึกข้อความ', 0, 'C', 0, 1, '', '', true);
         $result = DB::select($sql);
         foreach ($result as $key) {
             $pdf->SetFont('angsanaupc', 'B', 14, '', true);
             $pdf->SetXY(10, 32);
             $pdf->MultiCell(25, 0, 'ส่วนราชการ', 0, 'L', 0, 1, '', '', true);
             //$pdf->SetFont('angsanaupc','',14,'',true);
             $pdf->SetXY(35, 32);
             $pdf->MultiCell(160, 0, 'ฝ่าย........................................................................................โรงพยาบาลโนนไทย อำเภอโนนไทย จังหวัดนครราชสีมา', 0, 'L', 0, 1, '', '', true);
             $pdf->SetXY(44, 31);
             $pdf->MultiCell(65, 0, $key->department, 0, 'L', 0, 1, '', '', true);
             //$pdf->SetFont('angsanaupc','B',14,'',true);
             $pdf->SetXY(10, 40);
             $pdf->MultiCell(10, 0, 'ที่', 0, 'L', 0, 1, '', '', true);
             //$pdf->SetFont('angsanaupc','B',14,'',true);
             $pdf->SetXY(20, 40);
             $pdf->MultiCell(170, 0, 'นม 0032.301/...........................................วันที่.............................................................................', 0, 'L', 0, 1, '', '', true);
             $pdf->SetXY(43, 39);
             $pdf->MultiCell(31, 0, $key->num_nm, 0, 'L', 0, 1, '', '', true);
             $pdf->SetXY(83, 39);
             $pdf->MultiCell(44, 0, $key->date_nm == '0000-00-00' ? '' : $this->get_monthyearThai($key->date_nm), 0, 'L', 0, 1, '', '', true);
             //$pdf->SetFont('angsanaupc','B',14,'',true);
             $pdf->SetXY(10, 48);
             $pdf->MultiCell(10, 0, 'เรื่อง', 0, 'L', 0, 1, '', '', true);
             //$pdf->SetFont('angsanaupc','B',14,'',true);
             $pdf->SetXY(20, 48);
             $pdf->MultiCell(60, 0, ' ขออนุมัติไปราชการ', 0, 'L', 0, 1, '', '', true);
             $style = array('width' => 0.1, 'cap' => 'butt', 'join' => 'miter', 'dash' => '', 'phase' => 5, 'color' => array(0, 0, 0));
             $pdf->Line(10, 57, 195, 57, $style);
             //$pdf->SetFont('angsanaupc','B',14,'',true);
             $pdf->SetXY(10, 62);
             $pdf->MultiCell(70, 0, 'เรียน ผู้อำนวยการโรงพยาบาลโนนไทย', 0, 'L', 0, 1, '', '', true);
             $pdf->SetXY(20, 72);
             $pdf->MultiCell(176, 0, 'ด้วยข้าพเจ้า..........................................................................ตำแหน่ง...........................................................................................................', 0, 'L', 0, 1, '', '', true);
             $pdf->SetXY(39, 71);
             $pdf->MultiCell(55, 0, $key->req_name, 0, 'L', 0, 1, '', '', true);
             $pdf->SetXY(108, 71);
             $pdf->MultiCell(70, 0, $key->position, 0, 'L', 0, 1, '', '', true);
             $sql2 = ' select * from c_together where together_id=' . $key->together_id . ' ';
             $result2 = DB::select($sql2);
             $n = 0;
             $r = 0;
             $pdf->SetXY(10, 80);
             $pdf->MultiCell(20, 0, 'พร้อมด้วย', 0, 'L', 0, 1, '', '', true);
             if (count($result2) > 0) {
                 foreach ($result2 as $key2) {
                     $n++;
                     $r = $r + 7;
                     $pdf->SetXY(20, 84 + $r);
                     $pdf->MultiCell(176, 0, $n . '.................................................................................ตำแหน่ง.....................................................................................................................', 0, 'L', 0, 1, '', '', true);
                     $pdf->SetXY(25, 83 + $r);
                     $pdf->MultiCell(60, 0, $key2->req_name, 0, 'L', 0, 1, '', '', true);
                     $pdf->SetXY(100, 83 + $r);
                     $pdf->MultiCell(90, 0, $key2->position, 0, 'L', 0, 1, '', '', true);
                 }
             } else {
                 $pdf->SetXY(10, 85);
                 $pdf->MultiCell(20, 0, '-', 0, 'L', 0, 1, '', '', true);
             }
             $pdf->SetXY(10, 91 + $r);
             $pdf->MultiCell(186, 0, 'ขออนุมัติเดินทางไปราชการที่.............................................................................หน่วยงานผู้จัด...............................................................................', 0, 'L', 0, 1, '', '', true);
             $pdf->SetXY(50, 90 + $r);
             $pdf->MultiCell(59, 0, $key->location, 0, 'L', 0, 1, '', '', true);
             $pdf->SetXY(130, 90 + $r);
             $pdf->MultiCell(60, 0, $key->institution, 0, 'L', 0, 1, '', '', true);
             $pdf->SetXY(10, 97 + $r);
             $pdf->MultiCell(186, 0, 'เรื่อง...........................................................................................................................................................................................................................', 0, 'L', 0, 1, '', '', true);
             $pdf->SetXY(20, 96 + $r);
             $pdf->MultiCell(175, 0, $key->title, 0, 'L', 0, 1, '', '', true);
             $pdf->SetXY(10, 103 + $r);
             $pdf->MultiCell(187, 0, 'ตามหนังสือที่.........................................................................................................................ลงวันที่........................................................................', 0, 'L', 0, 1, '', '', true);
             $pdf->SetXY(32, 102 + $r);
             $pdf->MultiCell(74, 0, $key->ref_book_number, 0, 'L', 0, 1, '', '', true);
             $pdf->SetXY(136, 102 + $r);
             $pdf->MultiCell(50, 0, $key->ref_book_date == '0000-00-00' ? '' : $this->get_monthyearThai($key->ref_book_date), 0, 'L', 0, 1, '', '', true);
             $pdf->SetXY(10, 110 + $r);
             $pdf->MultiCell(186, 0, 'ทั้งนี้ตั้งแต่วันที่.........................................................................ถึงวันที่...........................................................................รวม............................วัน', 0, 'L', 0, 1, '', '', true);
             $pdf->SetXY(34, 109 + $r);
             $pdf->MultiCell(55, 0, $key->startdate == '0000-00-00' ? '' : $this->get_monthyearThai($key->startdate), 0, 'L', 0, 1, '', '', true);
             $pdf->SetXY(100, 109 + $r);
             $pdf->MultiCell(53, 0, $key->enddate == '0000-00-00' ? '' : $this->get_monthyearThai($key->enddate), 0, 'L', 0, 1, '', '', true);
             $pdf->SetXY(167, 109 + $r);
             $pdf->MultiCell(20, 0, $key->allday, 0, 'L', 0, 1, '', '', true);
             $pdf->SetXY(10, 116 + $r);
             $pdf->MultiCell(186, 0, 'สำหรับค่าใช้จ่ายในการเดินทางไปราชการขอเบิกจ่ายเงินบำรุงของโรงพยาบาล และขอใช้รถยนต์เดินทางไปราชการครั้งนี้', 0, 'L', 0, 1, '', '', true);
             $pdf->SetXY(20, 125 + $r);
             $pdf->MultiCell(6, 0, $key->usecar1 == 1 ? '/' : '', 1, 'C', 0, 1, '', '', true);
             $pdf->SetXY(29, 125 + $r);
             $pdf->MultiCell(60, 0, 'ใช้รถยนต์ของทางโรงพยาบาลโนนไทย', 0, 'L', 0, 1, '', '', true);
             $pdf->SetXY(20, 135 + $r);
             $pdf->MultiCell(6, 0, $key->usecar2 == 1 ? '/' : '', 1, 'C', 0, 1, '', '', true);
             $pdf->SetXY(29, 135 + $r);
             $pdf->MultiCell(170, 0, 'ใช้รถยนต์ส่วนตัว หมายเลขทะเบียน.......................................................................ตามหลักเกณฑ์การเบิกค่า', 0, 'L', 0, 1, '', '', true);
             $pdf->SetXY(84, 134 + $r);
             $pdf->MultiCell(40, 0, $key->usecar2_car_number, 0, 'C', 0, 1, '', '', true);
             $pdf->SetXY(29, 141 + $r);
             $pdf->MultiCell(170, 0, 'ยานพาหนะส่วนตัวในการเดินทางไปราชการ กิโลเมตรละ 4 บาท เป็นเงิน................................................บาท', 0, 'L', 0, 1, '', '', true);
             $pdf->SetXY(123, 140 + $r);
             $pdf->MultiCell(38, 0, $key->usecar2_km_money, 0, 'C', 0, 1, '', '', true);
             $pdf->SetXY(20, 149 + $r);
             $pdf->MultiCell(6, 0, $key->usecar3 == 1 ? '/' : '', 1, 'C', 0, 1, '', '', true);
             $pdf->SetXY(29, 149 + $r);
             $pdf->MultiCell(170, 0, 'อื่น ๆ (ระบุ)......................................................................................................................................................................................', 0, 'L', 0, 1, '', '', true);
             $pdf->SetXY(50, 148 + $r);
             $pdf->MultiCell(140, 0, $key->usecar3_detail, 0, 'L', 0, 1, '', '', true);
             $pdf->SetXY(29, 158 + $r);
             $pdf->MultiCell(140, 0, 'จึงเรียนมาเพื่อทราบ และโปรดพิจารณาอนุมัติด้วย จะเป็นพระคุณ', 0, 'L', 0, 1, '', '', true);
             $pdf->SetXY(95, 168 + $r);
             $pdf->MultiCell(100, 0, '(ลงชื่อ)...............................................................ผู้ขอ', 0, 'R', 0, 1, '', '', true);
             $pdf->SetXY(122, 167 + $r);
             $pdf->MultiCell(64, 0, '', 0, 'C', 0, 1, '', '', true);
             $pdf->SetXY(128, 175 + $r);
             $pdf->MultiCell(69, 0, '(............................................................)', 0, 'C', 0, 1, '', '', true);
             $pdf->SetXY(129, 174 + $r);
             $pdf->MultiCell(64, 0, $key->regis_user_req, 0, 'C', 0, 1, '', '', true);
             $h_re = DB::Select('select * from n_department_header where departmentName="' . $key->department . '" ');
             foreach ($h_re as $k_h) {
                 $header_name = $k_h->header_name;
             }
             if (!isset($header_name)) {
                 $header_name = '';
             }
             $pdf->SetXY(10, 186 + $r);
             $pdf->MultiCell(68, 0, 'เสนอ   ผู้อำนวยการโรงพยาบาลโนนไทย', 0, 'L', 0, 1, '', '', true);
             $pdf->SetXY(11, 194 + $r);
             $pdf->MultiCell(69, 0, '...................................................', 0, 'C', 0, 1, '', '', true);
             $pdf->SetXY(10, 204 + $r);
             $pdf->MultiCell(90, 0, '(ลงชื่อ).........................................................หัวหน้าฝ่าย', 0, 'L', 0, 1, '', '', true);
             $pdf->SetXY(18, 212 + $r);
             $pdf->MultiCell(69, 0, '(.........................................................)', 0, 'L', 0, 1, '', '', true);
             $pdf->SetXY(20, 211 + $r);
             $pdf->MultiCell(45, 0, $header_name, 0, 'C', 0, 1, '', '', true);
             $pdf->SetXY(120, 194 + $r);
             $pdf->MultiCell(6, 0, $key->daytrue == 1 ? '/' : '', 1, 'C', 0, 1, '', '', true);
             $pdf->SetXY(123, 194 + $r);
             $pdf->MultiCell(40, 0, 'ไม่เป็นวันทำการ', 0, 'C', 0, 1, '', '', true);
             $pdf->SetXY(120, 204 + $r);
             $pdf->MultiCell(6, 0, $key->dayflase == 1 ? '/' : '', 1, 'C', 0, 1, '', '', true);
             $pdf->SetXY(123, 204 + $r);
             $pdf->MultiCell(40, 0, 'เป็นวันทำการ', 0, 'C', 0, 1, '', '', true);
             $pdf->SetXY(105, 219 + $r);
             $pdf->MultiCell(90, 0, '(ลงชื่อ)...........................................................ผู้อนุมัติ', 0, 'R', 0, 1, '', '', true);
             $pdf->SetXY(115, 227 + $r);
             $pdf->MultiCell(90, 0, '( นายบุญชัย  ธนบัตรชัย )', 0, 'C', 0, 1, '', '', true);
             $pdf->SetXY(115, 235 + $r);
             $pdf->MultiCell(90, 0, 'ผู้อำนวยการโรงพยาบาลโนนไทย', 0, 'C', 0, 1, '', '', true);
         }
         //end foreach
         $filename = storage_path() . '/report_reserve.pdf';
         $contents = $pdf->output($filename, 'I');
         $headers = array('Content-Type' => 'application/pdf');
         return Response::make($contents, 200, $headers);
     } else {
         $data = DB::table('c_req_cars')->where('godate', '>=', date('Y-m-d'))->orderBy('godate', 'asc')->paginate(10);
         return View::make('home.index', array('data' => $data));
     }
 }
Example #25
0
    $y += 32;
    // new row
}
$x = 115;
$y = 35;
$w = 25;
$h = 50;
for ($i = 0; $i < 3; ++$i) {
    $fitbox = $horizontal_alignments[$i] . ' ';
    $x = 115;
    for ($j = 0; $j < 3; ++$j) {
        $fitbox[1] = $vertical_alignments[$j];
        $pdf->Rect($x, $y, $w, $h, 'F', array(), array(128, 255, 255));
        $pdf->Image('images/image_demo.jpg', $x, $y, $w, $h, 'JPG', '', '', false, 300, '', false, false, 0, $fitbox, false, false);
        $x += 27;
        // new column
    }
    $y += 52;
    // new row
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Stretching, position and alignment example
$pdf->SetXY(110, 200);
$pdf->Image('images/image_demo.jpg', '', '', 40, 40, '', '', 'T', false, 300, '', false, false, 1, false, false, false);
$pdf->Image('images/image_demo.jpg', '', '', 40, 40, '', '', '', false, 300, '', false, false, 1, false, false, false);
// -------------------------------------------------------------------
//Close and output PDF document
$pdf->Output('example_009.pdf', 'I');
//============================================================+
// END OF FILE
//============================================================+
Example #26
0
<?php

$getItem = $_GET['data'];
require_once 'tcpdf/tcpdf.php';
// создаем объект TCPDF - документ с размерами формата A4
// ориентация - книжная
// единицы измерения - миллиметры
// кодировка - UTF-8
$pdf = new TCPDF('P', 'mm', 'A4', true, 'UTF-8', false);
// убираем на всякий случай шапку и футер документа
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
$pdf->SetMargins(20, 25, 25);
// устанавливаем отступы (20 мм - слева, 25 мм - сверху, 25 мм - справа)
$pdf->AddPage();
// создаем первую страницу, на которой будет содержимое
$pdf->SetXY(90, 10);
// устанавливаем координаты вывода текста в рамке: 90 мм - отступ от левого края бумаги, 10 мм - от верхнего
$pdf->Cell(30, 6, $getItem, 1, 1, 'C');
// выводим ячейку с надписью шириной 30 мм и высотой 6 мм. Строка отцентрирована относительно границ ячейки
$pdf->Output('doc.pdf', 'I');
// выводим документ в браузер, заставляя его включить плагин для отображения PDF (если имеется)
Example #27
0
$pdf->SetFillColor(224, 235, 255);
$pdf->SetTextColor(0);
for ($i = 0; $i < count($columns); $i++) {
    $pdf->writeHTMLCell($w[$i], $header_h, $x_init, $y, $columns[$i] . "\n", 0, 0, 1);
    $x_init = $x_init + $w[$i];
}
// Line break - Line6
$row_height = round($pdf->getLastH());
$y = $y + $row_height;
// Color and font restoration
$pdf->SetFillColor(224, 235, 255);
$pdf->SetTextColor(0);
// Data
$fill = 0;
$x_init = $x;
$pdf->SetXY($x_init, $y);
$max_rows = 1;
foreach ($pdfdata as $rows) {
    $lc = array();
    for ($i = 0; $i < count($rows); $i++) {
        $lc[] = $pdf->getNumLines($rows[$i], $w[$i]);
    }
    //Max no of Lines the row occupies
    $linecount = max($lc);
    for ($i = 0; $i < count($rows); $i++) {
        $pdf->MultiCell($w[$i], $header_h * $linecount + $header_h, trim($rows[$i]) . "\n", 0, 'J', 0, 0, $x_init, $y, true);
        //$pdf->writeHTMLCell($w[$i], $row_height, $x_init, $y,$rows[$i]."\n",0,0,0);
        $x_init = $x_init + $w[$i];
        $pdf->SetX($x_init);
    }
    // Line break - Line X
Example #28
-1
 /**
  * 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;
 }
 /**
  * Renders (in PDF) the key (legend) of the graphics vertically to the left of the specified zone (xmin,ymin, xmax,ymax),
  * and the comment (if any) at the bottom of the page. Returns the position of remaining area.
  * @param TCPDF $oPdf
  * @param string $sComments
  * @param float $xMin
  * @param float $yMin
  * @param float $xMax
  * @param float $yMax
  * @param hash $aContextDefs
  * @return hash An array ('xmin' => , 'xmax' => ,'ymin' => , 'ymax' => ) of the remaining available area to paint the graph
  */
 protected function RenderKey(TCPDF $oPdf, $sComments, $xMin, $yMin, $xMax, $yMax, $aContextDefs)
 {
     $fFontSize = 7;
     // in mm
     $fIconSize = 6;
     // in mm
     $fPadding = 1;
     // in mm
     $oIterator = new RelationTypeIterator($this, 'Node');
     $fMaxWidth = max($oPdf->GetStringWidth(Dict::S('UI:Relation:Key')) - $fIconSize, $oPdf->GetStringWidth(Dict::S('UI:Relation:Comments')) - $fIconSize);
     $aClasses = array();
     $aIcons = array();
     $aContexts = array();
     $aContextIcons = array();
     $oPdf->SetFont('dejavusans', '', $fFontSize, '', true);
     foreach ($oIterator as $sId => $oNode) {
         if ($sClass = $oNode->GetObjectClass()) {
             if (!array_key_exists($sClass, $aClasses)) {
                 $sClassLabel = MetaModel::GetName($sClass);
                 $width = $oPdf->GetStringWidth($sClassLabel);
                 $fMaxWidth = max($width, $fMaxWidth);
                 $aClasses[$sClass] = $sClassLabel;
                 $sIconUrl = $oNode->GetProperty('icon_url');
                 $sIconPath = str_replace(utils::GetAbsoluteUrlModulesRoot(), APPROOT . 'env-' . utils::GetCurrentEnvironment() . '/', $sIconUrl);
                 $aIcons[$sClass] = $sIconPath;
             }
         }
         $aContextRootCauses = $oNode->GetProperty('context_root_causes');
         if (!is_null($aContextRootCauses)) {
             foreach ($aContextRootCauses as $key => $aObjects) {
                 $aContexts[$key] = Dict::S($aContextDefs[$key]['dict']);
                 $aContextIcons[$key] = APPROOT . 'env-' . utils::GetCurrentEnvironment() . '/' . $aContextDefs[$key]['icon'];
             }
         }
     }
     $oPdf->SetXY($xMin + $fPadding, $yMin + $fPadding);
     $yPos = $yMin + $fPadding;
     $oPdf->SetFillColor(225, 225, 225);
     $oPdf->Cell($fIconSize + $fPadding + $fMaxWidth, $fIconSize + $fPadding, Dict::S('UI:Relation:Key'), 0, 1, 'C', true);
     $yPos += $fIconSize + 2 * $fPadding;
     foreach ($aClasses as $sClass => $sLabel) {
         $oPdf->SetX($xMin + $fIconSize + $fPadding);
         $oPdf->Cell(0, $fIconSize + 2 * $fPadding, $sLabel, 0, 1);
         $oPdf->Image($aIcons[$sClass], $xMin + 1, $yPos, $fIconSize, $fIconSize);
         $yPos += $fIconSize + 2 * $fPadding;
     }
     foreach ($aContexts as $key => $sLabel) {
         $oPdf->SetX($xMin + $fIconSize + $fPadding);
         $oPdf->Cell(0, $fIconSize + 2 * $fPadding, $sLabel, 0, 1);
         $oPdf->Image($aContextIcons[$key], $xMin + 1 + $fIconSize * 0.125, $yPos + $fIconSize * 0.125, $fIconSize * 0.75, $fIconSize * 0.75);
         $yPos += $fIconSize + 2 * $fPadding;
     }
     $oPdf->Rect($xMin, $yMin, $fMaxWidth + $fIconSize + 3 * $fPadding, $yMax - $yMin, 'D');
     if ($sComments != '') {
         // Draw the comment text (surrounded by a rectangle)
         $xPos = $xMin + $fMaxWidth + $fIconSize + 4 * $fPadding;
         $w = $xMax - $xPos - 2 * $fPadding;
         $iNbLines = 1;
         $sText = '<p>' . str_replace("\n", '<br/>', htmlentities($sComments, ENT_QUOTES, 'UTF-8'), $iNbLines) . '</p>';
         $fLineHeight = $oPdf->getStringHeight($w, $sText);
         $h = (1 + $iNbLines) * $fLineHeight;
         $yPos = $yMax - 2 * $fPadding - $h;
         $oPdf->writeHTMLCell($w, $h, $xPos + $fPadding, $yPos + $fPadding, $sText, 0, 1);
         $oPdf->Rect($xPos, $yPos, $w + 2 * $fPadding, $h + 2 * $fPadding, 'D');
         $yMax = $yPos - $fPadding;
     }
     return array('xmin' => $xMin + $fMaxWidth + $fIconSize + 4 * $fPadding, 'xmax' => $xMax, 'ymin' => $yMin, 'ymax' => $yMax);
 }
 /**
  *   Show table for lines
  *
  *   @param		TCPDF			$pdf     		Object PDF
  *   @param		string		$tab_top		Top position of table
  *   @param		string		$tab_height		Height of table (rectangle)
  *   @param		int			$nexY			Y (not used)
  *   @param		Translate	$outputlangs	Langs object
  *   @param		int			$hidetop		1=Hide top bar of array and title, 0=Hide nothing, -1=Hide only title
  *   @param		int			$hidebottom		Hide bottom bar of array
  *   @return	void
  */
 function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0)
 {
     global $conf;
     // Force to disable hidetop and hidebottom
     $hidebottom = 0;
     if ($hidetop) {
         $hidetop = -1;
     }
     $default_font_size = pdf_getPDFFontSize($outputlangs);
     // Amount in (at tab_top - 1)
     $pdf->SetTextColor(0, 0, 0);
     $pdf->SetFont('', '', $default_font_size - 2);
     if (empty($hidetop)) {
         $titre = $outputlangs->transnoentities("AmountInCurrency", $outputlangs->transnoentitiesnoconv("Currency" . $conf->currency));
         $pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top - 4);
         $pdf->MultiCell($pdf->GetStringWidth($titre) + 3, 2, $titre);
         //$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR='230,230,230';
         if (!empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) {
             $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, 5, 'F', null, explode(',', $conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR));
         }
     }
     $pdf->SetDrawColor(128, 128, 128);
     $pdf->SetFont('', '', $default_font_size - 1);
     // Output Rect
     $this->printRect($pdf, $this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $tab_height, $hidetop, $hidebottom);
     // Rect prend une longueur en 3eme param et 4eme param
     if (empty($hidetop)) {
         $pdf->line($this->marge_gauche, $tab_top + 5, $this->page_largeur - $this->marge_droite, $tab_top + 5);
         // line prend une position y en 2eme param et 4eme param
         $pdf->SetXY($this->posxdesc - 1, $tab_top + 1);
         $pdf->MultiCell(108, 2, $outputlangs->transnoentities("Designation"), '', 'L');
     }
     if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) {
         $pdf->line($this->posxtva - 1, $tab_top, $this->posxtva - 1, $tab_top + $tab_height);
         if (empty($hidetop)) {
             $pdf->SetXY($this->posxtva - 3, $tab_top + 1);
             $pdf->MultiCell($this->posxup - $this->posxtva + 3, 2, $outputlangs->transnoentities("VAT"), '', 'C');
         }
     }
     $pdf->line($this->posxup - 1, $tab_top, $this->posxup - 1, $tab_top + $tab_height);
     if (empty($hidetop)) {
         $pdf->SetXY($this->posxup - 1, $tab_top + 1);
         $pdf->MultiCell($this->posxqty - $this->posxup - 1, 2, $outputlangs->transnoentities("PriceUHT"), '', 'C');
     }
     $pdf->line($this->posxqty - 1, $tab_top, $this->posxqty - 1, $tab_top + $tab_height);
     if (empty($hidetop)) {
         $pdf->SetXY($this->posxqty - 1, $tab_top + 1);
         if ($conf->global->PRODUCT_USE_UNITS) {
             $pdf->MultiCell($this->posxunit - $this->posxqty - 1, 2, $outputlangs->transnoentities("Qty"), '', 'C');
         } else {
             $pdf->MultiCell($this->posxdiscount - $this->posxqty - 1, 2, $outputlangs->transnoentities("Qty"), '', 'C');
         }
     }
     if ($conf->global->PRODUCT_USE_UNITS) {
         $pdf->line($this->posxunit - 1, $tab_top, $this->posxunit - 1, $tab_top + $tab_height);
         if (empty($hidetop)) {
             $pdf->SetXY($this->posxunit - 1, $tab_top + 1);
             $pdf->MultiCell($this->posxdiscount - $this->posxunit - 1, 2, $outputlangs->transnoentities("Unit"), '', 'C');
         }
     }
     $pdf->line($this->posxdiscount - 1, $tab_top, $this->posxdiscount - 1, $tab_top + $tab_height);
     if (empty($hidetop)) {
         if ($this->atleastonediscount) {
             $pdf->SetXY($this->posxdiscount - 1, $tab_top + 1);
             $pdf->MultiCell($this->postotalht - $this->posxdiscount + 1, 2, $outputlangs->transnoentities("ReductionShort"), '', 'C');
         }
     }
     if ($this->atleastonediscount) {
         $pdf->line($this->postotalht, $tab_top, $this->postotalht, $tab_top + $tab_height);
     }
     if (empty($hidetop)) {
         $pdf->SetXY($this->postotalht - 1, $tab_top + 1);
         $pdf->MultiCell(30, 2, $outputlangs->transnoentities("TotalHT"), '', 'C');
     }
 }