Example #1
8
 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 012');
     $pdf->SetSubject('TCPDF Tutorial');
     $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
     // disable header and footer
     $pdf->setPrintHeader(false);
     $pdf->setPrintFooter(false);
     // set default monospaced font
     $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
     // set margins
     $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
     // set auto page breaks
     $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
     // set image scale factor
     $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
     // set some language-dependent strings (optional)
     $pdf->setLanguageArray($this->langSettings);
     // ---------------------------------------------------------
     // set font
     $pdf->SetFont('helvetica', '', 10);
     // add a page
     $pdf->AddPage();
     $style = array('width' => 0.5, 'cap' => 'butt', 'join' => 'miter', 'dash' => '10,20,5,10', 'phase' => 10, 'color' => array(255, 0, 0));
     $style2 = array('width' => 0.5, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(255, 0, 0));
     $style3 = array('width' => 1, 'cap' => 'round', 'join' => 'round', 'dash' => '2,10', 'color' => array(255, 0, 0));
     $style4 = array('L' => 0, 'T' => array('width' => 0.25, 'cap' => 'butt', 'join' => 'miter', 'dash' => '20,10', 'phase' => 10, 'color' => array(100, 100, 255)), 'R' => array('width' => 0.5, 'cap' => 'round', 'join' => 'miter', 'dash' => 0, 'color' => array(50, 50, 127)), 'B' => array('width' => 0.75, 'cap' => 'square', 'join' => 'miter', 'dash' => '30,10,5,10'));
     $style5 = array('width' => 0.25, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 64, 128));
     $style6 = array('width' => 0.5, 'cap' => 'butt', 'join' => 'miter', 'dash' => '10,10', 'color' => array(0, 128, 0));
     $style7 = array('width' => 0.5, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(255, 128, 0));
     // Line
     $pdf->Text(5, 4, 'Line examples');
     $pdf->Line(5, 10, 80, 30, $style);
     $pdf->Line(5, 10, 5, 30, $style2);
     $pdf->Line(5, 10, 80, 10, $style3);
     // Rect
     $pdf->Text(100, 4, 'Rectangle examples');
     $pdf->Rect(100, 10, 40, 20, 'DF', $style4, array(220, 220, 200));
     $pdf->Rect(145, 10, 40, 20, 'D', array('all' => $style3));
     // Curve
     $pdf->Text(5, 34, 'Curve examples');
     $pdf->Curve(5, 40, 30, 55, 70, 45, 60, 75, null, $style6);
     $pdf->Curve(80, 40, 70, 75, 150, 45, 100, 75, 'F', $style6);
     $pdf->Curve(140, 40, 150, 55, 180, 45, 200, 75, 'DF', $style6, array(200, 220, 200));
     // Circle and ellipse
     $pdf->Text(5, 79, 'Circle and ellipse examples');
     $pdf->SetLineStyle($style5);
     $pdf->Circle(25, 105, 20);
     $pdf->Circle(25, 105, 10, 90, 180, null, $style6);
     $pdf->Circle(25, 105, 10, 270, 360, 'F');
     $pdf->Circle(25, 105, 10, 270, 360, 'C', $style6);
     $pdf->SetLineStyle($style5);
     $pdf->Ellipse(100, 103, 40, 20);
     $pdf->Ellipse(100, 105, 20, 10, 0, 90, 180, null, $style6);
     $pdf->Ellipse(100, 105, 20, 10, 0, 270, 360, 'DF', $style6);
     $pdf->SetLineStyle($style5);
     $pdf->Ellipse(175, 103, 30, 15, 45);
     $pdf->Ellipse(175, 105, 15, 7.5, 45, 90, 180, null, $style6);
     $pdf->Ellipse(175, 105, 15, 7.5, 45, 270, 360, 'F', $style6, array(220, 200, 200));
     // Polygon
     $pdf->Text(5, 129, 'Polygon examples');
     $pdf->SetLineStyle(array('width' => 0.5, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0)));
     $pdf->Polygon(array(5, 135, 45, 135, 15, 165));
     $pdf->Polygon(array(60, 135, 80, 135, 80, 155, 70, 165, 50, 155), 'DF', array($style6, $style7, $style7, 0, $style6), array(220, 200, 200));
     $pdf->Polygon(array(120, 135, 140, 135, 150, 155, 110, 155), 'D', array($style6, 0, $style7, $style6));
     $pdf->Polygon(array(160, 135, 190, 155, 170, 155, 200, 160, 160, 165), 'DF', array('all' => $style6), array(220, 220, 220));
     // Polygonal Line
     $pdf->SetLineStyle(array('width' => 0.5, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 164)));
     $pdf->PolyLine(array(80, 165, 90, 160, 100, 165, 110, 160, 120, 165, 130, 160, 140, 165), 'D', array(), array());
     // Regular polygon
     $pdf->Text(5, 169, 'Regular polygon examples');
     $pdf->SetLineStyle($style5);
     $pdf->RegularPolygon(20, 190, 15, 6, 0, 1, 'F');
     $pdf->RegularPolygon(55, 190, 15, 6);
     $pdf->RegularPolygon(55, 190, 10, 6, 45, 0, 'DF', array($style6, 0, $style7, 0, $style7, $style7));
     $pdf->RegularPolygon(90, 190, 15, 3, 0, 1, 'DF', array('all' => $style5), array(200, 220, 200), 'F', array(255, 200, 200));
     $pdf->RegularPolygon(125, 190, 15, 4, 30, 1, null, array('all' => $style5), null, null, $style6);
     $pdf->RegularPolygon(160, 190, 15, 10);
     // Star polygon
     $pdf->Text(5, 209, 'Star polygon examples');
     $pdf->SetLineStyle($style5);
     $pdf->StarPolygon(20, 230, 15, 20, 3, 0, 1, 'F');
     $pdf->StarPolygon(55, 230, 15, 12, 5);
     $pdf->StarPolygon(55, 230, 7, 12, 5, 45, 0, 'DF', array('all' => $style7), array(220, 220, 200), 'F', array(255, 200, 200));
     $pdf->StarPolygon(90, 230, 15, 20, 6, 0, 1, 'DF', array('all' => $style5), array(220, 220, 200), 'F', array(255, 200, 200));
     $pdf->StarPolygon(125, 230, 15, 5, 2, 30, 1, null, array('all' => $style5), null, null, $style6);
     $pdf->StarPolygon(160, 230, 15, 10, 3);
     $pdf->StarPolygon(160, 230, 7, 50, 26);
     // Rounded rectangle
     $pdf->Text(5, 249, 'Rounded rectangle examples');
     $pdf->SetLineStyle(array('width' => 0.5, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0)));
     $pdf->RoundedRect(5, 255, 40, 30, 3.5, '1111', 'DF');
     $pdf->RoundedRect(50, 255, 40, 30, 6.5, '1000');
     $pdf->RoundedRect(95, 255, 40, 30, 10.0, '1111', null, $style6);
     $pdf->RoundedRect(140, 255, 40, 30, 8.0, '0101', 'DF', $style6, array(200, 200, 200));
     // Arrows
     $pdf->Text(185, 249, 'Arrows');
     $pdf->SetLineStyle($style5);
     $pdf->SetFillColor(255, 0, 0);
     $pdf->Arrow(200, 280, 185, 266, 0, 5, 15);
     $pdf->Arrow(200, 280, 190, 263, 1, 5, 15);
     $pdf->Arrow(200, 280, 195, 261, 2, 5, 15);
     $pdf->Arrow(200, 280, 200, 260, 3, 5, 15);
     // - . - . - . - . - . - . - . - . - . - . - . - . - . - . -
     // ellipse
     // add a page
     $pdf->AddPage();
     $pdf->Cell(0, 0, 'Arc of Ellipse');
     // center of ellipse
     $xc = 100;
     $yc = 100;
     // X Y axis
     $pdf->SetDrawColor(200, 200, 200);
     $pdf->Line($xc - 50, $yc, $xc + 50, $yc);
     $pdf->Line($xc, $yc - 50, $xc, $yc + 50);
     // ellipse axis
     $pdf->SetDrawColor(200, 220, 255);
     $pdf->Line($xc - 50, $yc - 50, $xc + 50, $yc + 50);
     $pdf->Line($xc - 50, $yc + 50, $xc + 50, $yc - 50);
     // ellipse
     $pdf->SetDrawColor(200, 255, 200);
     $pdf->Ellipse($xc, $yc, 30, 15, 45, 0, 360, 'D', array(), array(), 2);
     // ellipse arc
     $pdf->SetDrawColor(255, 0, 0);
     $pdf->Ellipse($xc, $yc, 30, 15, 45, 45, 90, 'D', array(), array(), 2);
     $this->comparePdfs($pdf);
 }
 /**
  * Sets the fill colour
  *
  * @param array $color
  */
 protected function _set_fill_colour($colour)
 {
     $colour[0] = round(255 * $colour[0]);
     $colour[1] = round(255 * $colour[1]);
     $colour[2] = round(255 * $colour[2]);
     if (is_null($this->_last_fill_color) || $color != $this->_last_fill_color) {
         $this->_pdf->SetDrawColor($color[0], $color[1], $color[2]);
         $this->_last_fill_color = $color;
     }
 }
 public function RenderAsPDF(TCPDF $oPdf, DisplayableGraph $oGraph, $fScale, $aContextDefs)
 {
     $oPdf->SetAlpha(1);
     if ($this->GetProperty('is_reached_count') > $this->GetProperty('threshold')) {
         $oPdf->SetFillColor(200, 0, 0);
     } else {
         $oPdf->SetFillColor(144, 144, 144);
     }
     $oPdf->SetDrawColor(0, 0, 0);
     $oPdf->Circle($this->x * $fScale, $this->y * $fScale, 16 * $fScale, 0, 360, 'DF');
     $oPdf->SetTextColor(255, 255, 255);
     $oPdf->SetFont('dejavusans', '', 28 * $fScale, '', true);
     $sLabel = (string) $this->GetProperty('label');
     $width = $oPdf->GetStringWidth($sLabel, 'dejavusans', 'B', 24 * $fScale);
     $height = $oPdf->GetStringHeight(1000, $sLabel);
     $xPos = (double) $this->x * $fScale - $width / 2;
     $yPos = (double) $this->y * $fScale - $height / 2;
     $oPdf->SetXY(($this->x - 16) * $fScale, ($this->y - 16) * $fScale);
     $oPdf->Cell(32 * $fScale, 32 * $fScale, $sLabel, 0, 0, 'C', 0, '', 0, false, 'T', 'C');
 }
Example #4
0
 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 025');
     $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 . ' 025', PDF_HEADER_STRING);
     // set header and footer fonts
     $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
     $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
     // set default monospaced font
     $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
     // set margins
     $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
     $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
     $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
     // set auto page breaks
     $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
     // set image scale factor
     $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
     // set some language-dependent strings (optional)
     $pdf->setLanguageArray($this->langSettings);
     // ---------------------------------------------------------
     // set font
     $pdf->SetFont('helvetica', '', 12);
     // add a page
     $pdf->AddPage();
     $txt = 'You can set the transparency of PDF objects using the setAlpha() method.';
     $pdf->Write(0, $txt, '', 0, '', true, 0, false, false, 0);
     /*
      * setAlpha() gives transparency support. You can set the
      * alpha channel from 0 (fully transparent) to 1 (fully
      * opaque). It applies to all elements (text, drawings,
      * images).
      */
     $pdf->SetLineWidth(2);
     // draw opaque red square
     $pdf->SetFillColor(255, 0, 0);
     $pdf->SetDrawColor(127, 0, 0);
     $pdf->Rect(30, 40, 60, 60, 'DF');
     // set alpha to semi-transparency
     $pdf->SetAlpha(0.5);
     // draw green square
     $pdf->SetFillColor(0, 255, 0);
     $pdf->SetDrawColor(0, 127, 0);
     $pdf->Rect(50, 60, 60, 60, 'DF');
     // draw blue square
     $pdf->SetFillColor(0, 0, 255);
     $pdf->SetDrawColor(0, 0, 127);
     $pdf->Rect(70, 80, 60, 60, 'DF');
     // draw jpeg image
     $pdf->Image('tests/images/image_demo.jpg', 90, 100, 60, 60, '', 'http://www.tcpdf.org', '', true, 72);
     // restore full opacity
     $pdf->SetAlpha(1);
     $this->comparePdfs($pdf);
 }
Example #5
0
 public function display($arraydata, $y_axis = 0, $fielddata = false, $maxheight = 0)
 {
     $this->Rotate($arraydata["rotation"]);
     if ($arraydata["rotation"] != "") {
         if ($arraydata["rotation"] == "Left") {
             $w = $arraydata["width"];
             $arraydata["width"] = $arraydata["height"];
             $arraydata["height"] = $w;
             $this->pdf->SetXY($this->pdf->GetX() - $arraydata["width"], $this->pdf->GetY());
         } elseif ($arraydata["rotation"] == "Right") {
             $w = $arraydata["width"];
             $arraydata["width"] = $arraydata["height"];
             $arraydata["height"] = $w;
             $this->pdf->SetXY($this->pdf->GetX(), $this->pdf->GetY() - $arraydata["height"]);
         } elseif ($arraydata["rotation"] == "UpsideDown") {
             //soverflow"=>$stretchoverflow,"poverflow"
             $arraydata["soverflow"] = true;
             $arraydata["poverflow"] = true;
             //   $w=$arraydata["width"];
             // $arraydata["width"]=$arraydata["height"];
             //$arraydata["height"]=$w;
             $this->pdf->SetXY($this->pdf->GetX() - $arraydata["width"], $this->pdf->GetY() - $arraydata["height"]);
         }
     }
     if ($arraydata["type"] == "SetFont") {
         $arraydata["font"] = strtolower($arraydata["font"]);
         $fontfile = $this->fontdir . '/' . $arraydata["font"] . '.php';
         if (file_exists($fontfile) || $this->bypassnofont == false) {
             $fontfile = $this->fontdir . '/' . $arraydata["font"] . '.php';
             $this->pdf->SetFont($arraydata["font"], $arraydata["fontstyle"], $arraydata["fontsize"], $fontfile);
         } else {
             $arraydata["font"] = "freeserif";
             if ($arraydata["fontstyle"] == "") {
                 $this->pdf->SetFont('freeserif', $arraydata["fontstyle"], $arraydata["fontsize"], $this->fontdir . '/freeserif.php');
             } elseif ($arraydata["fontstyle"] == "B") {
                 $this->pdf->SetFont('freeserifb', $arraydata["fontstyle"], $arraydata["fontsize"], $this->fontdir . '/freeserifb.php');
             } elseif ($arraydata["fontstyle"] == "I") {
                 $this->pdf->SetFont('freeserifi', $arraydata["fontstyle"], $arraydata["fontsize"], $this->fontdir . '/freeserifi.php');
             } elseif ($arraydata["fontstyle"] == "BI") {
                 $this->pdf->SetFont('freeserifbi', $arraydata["fontstyle"], $arraydata["fontsize"], $this->fontdir . '/freeserifbi.php');
             } elseif ($arraydata["fontstyle"] == "BIU") {
                 $this->pdf->SetFont('freeserifbi', "BIU", $arraydata["fontsize"], $this->fontdir . '/freeserifbi.php');
             } elseif ($arraydata["fontstyle"] == "U") {
                 $this->pdf->SetFont('freeserif', "U", $arraydata["fontsize"], $this->fontdir . '/freeserif.php');
             } elseif ($arraydata["fontstyle"] == "BU") {
                 $this->pdf->SetFont('freeserifb', "U", $arraydata["fontsize"], $this->fontdir . '/freeserifb.php');
             } elseif ($arraydata["fontstyle"] == "IU") {
                 $this->pdf->SetFont('freeserifi', "IU", $arraydata["fontsize"], $this->fontdir . '/freeserifbi.php');
             }
         }
     } elseif ($arraydata["type"] == "subreport") {
         return $this->runSubReport($arraydata, $y_axis);
     } elseif ($arraydata["type"] == "MultiCell") {
         if ($fielddata == false) {
             $this->checkoverflow($arraydata, $this->updatePageNo($arraydata["txt"]), '', $maxheight);
         } elseif ($fielddata == true) {
             //$this->checkoverflow($arraydata,$this->updatePageNo($this->analyse_expression($arraydata["txt"],$arraydata["isPrintRepeatedValues"] )),$maxheight);
             $this->checkoverflow($arraydata, $this->updatePageNo($this->analyse_expression($arraydata["txt"], isset($arraydata["isPrintRepeatedValues"]) ? $arraydata["isPrintRepeatedValues"] : null)), $maxheight);
         }
     } elseif ($arraydata["type"] == "SetXY") {
         $this->pdf->SetXY($arraydata["x"] + $this->arrayPageSetting["leftMargin"], $arraydata["y"] + $y_axis);
     } elseif ($arraydata["type"] == "Cell") {
         //                print_r($arraydata);
         //              echo "<br/>";
         $this->pdf->Cell($arraydata["width"], $arraydata["height"], $this->updatePageNo($arraydata["txt"]), $arraydata["border"], $arraydata["ln"], $arraydata["align"], $arraydata["fill"], $arraydata["link"] . "", 0, true, "T", $arraydata["valign"]);
     } elseif ($arraydata["type"] == "Rect") {
         if ($arraydata['mode'] == 'Transparent') {
             $style = '';
         } else {
             $style = 'FD';
         }
         //      $this->pdf->SetLineStyle($arraydata['border']);
         $this->pdf->Rect($arraydata["x"] + $this->arrayPageSetting["leftMargin"], $arraydata["y"] + $y_axis, $arraydata["width"], $arraydata["height"], $style, $arraydata['border'], $arraydata['fillcolor']);
     } elseif ($arraydata["type"] == "RoundedRect") {
         if ($arraydata['mode'] == 'Transparent') {
             $style = '';
         } else {
             $style = 'FD';
         }
         //
         //        $this->pdf->SetLineStyle($arraydata['border']);
         $this->pdf->RoundedRect($arraydata["x"] + $this->arrayPageSetting["leftMargin"], $arraydata["y"] + $y_axis, $arraydata["width"], $arraydata["height"], $arraydata["radius"], '1111', $style, $arraydata['border'], $arraydata['fillcolor']);
     } elseif ($arraydata["type"] == "Ellipse") {
         //$this->pdf->SetLineStyle($arraydata['border']);
         $this->pdf->Ellipse($arraydata["x"] + $arraydata["width"] / 2 + $this->arrayPageSetting["leftMargin"], $arraydata["y"] + $y_axis + $arraydata["height"] / 2, $arraydata["width"] / 2, $arraydata["height"] / 2, 0, 0, 360, 'FD', $arraydata['border'], $arraydata['fillcolor']);
     } elseif ($arraydata["type"] == "Image") {
         //echo $arraydata["path"];
         $path = $this->analyse_expression($arraydata["path"]);
         $imgtype = substr($path, -3);
         $arraydata["link"] = $arraydata["link"] . "";
         if ($imgtype == 'jpg' || right($path, 3) == 'jpg' || right($path, 4) == 'jpeg') {
             $imgtype = "JPEG";
         } elseif ($imgtype == 'png' || $imgtype == 'PNG') {
             $imgtype = "PNG";
         }
         //echo $path;
         if (file_exists($this->imagesPath . $path) || $this->left($path, 4) == 'http') {
             //$path="/Applications/XAMPP/xamppfiles/simbiz/modules/simantz/images/modulepic.jpg";
             //  $path="/simbiz/images/pendingno.png";
             if ($arraydata["link"] == "") {
                 $this->pdf->Image($this->imagesPath . $path, $arraydata["x"] + $this->arrayPageSetting["leftMargin"], $arraydata["y"] + $y_axis, $arraydata["width"], $arraydata["height"], $imgtype, $arraydata["link"]);
             } else {
                 //                 if($arraydata['linktarget']=='Blank' && strpos($_SERVER['HTTP_USER_AGENT'],"Safari")!==false &&     strpos($_SERVER['HTTP_USER_AGENT'],"Chrome")==false){
                 //                        $href="javascript:window.open('".$arraydata["link"]."');";
                 //                        $imagehtml='<A  href="'.$href.'"><img src="'.$path.'" '.
                 //                                'width="'. $arraydata["width"] .'" height="'.$arraydata["height"].'" ></A>';
                 //                        $this->pdf->writeHTMLCell($arraydata["width"],$arraydata["height"],
                 //                            $arraydata["x"]+$this->arrayPageSetting["leftMargin"],$arraydata["y"]+$y_axis,$imagehtml);
                 //                 }
                 //                else
                 $this->pdf->Image($path, $arraydata["x"] + $this->arrayPageSetting["leftMargin"], $arraydata["y"] + $y_axis, $arraydata["width"], $arraydata["height"], $imgtype, $arraydata["link"]);
             }
         } elseif ($this->left($path, 22) == "data:image/jpeg;base64") {
             $imgtype = "JPEG";
             $img = str_replace('data:image/jpeg;base64,', '', $path);
             $imgdata = base64_decode($img);
             $this->pdf->Image('@' . $imgdata, $arraydata["x"] + $this->arrayPageSetting["leftMargin"], $arraydata["y"] + $y_axis, $arraydata["width"], $arraydata["height"], '', $arraydata["link"]);
         } elseif ($this->left($path, 22) == "data:image/png;base64,") {
             $imgtype = "PNG";
             // $this->pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
             $img = str_replace('data:image/png;base64,', '', $path);
             $imgdata = base64_decode($img);
             $this->pdf->Image('@' . $imgdata, $arraydata["x"] + $this->arrayPageSetting["leftMargin"], $arraydata["y"] + $y_axis, $arraydata["width"], $arraydata["height"], '', $arraydata["link"]);
         }
     } elseif ($arraydata["type"] == "SetTextColor") {
         $this->textcolor_r = $arraydata['r'];
         $this->textcolor_g = $arraydata['g'];
         $this->textcolor_b = $arraydata['b'];
         if ($this->hideheader == true && $this->currentband == 'pageHeader') {
             $this->pdf->SetTextColor(100, 33, 30);
         } else {
             $this->pdf->SetTextColor($arraydata["r"], $arraydata["g"], $arraydata["b"]);
         }
     } elseif ($arraydata["type"] == "SetDrawColor") {
         $this->drawcolor_r = $arraydata['r'];
         $this->drawcolor_g = $arraydata['g'];
         $this->drawcolor_b = $arraydata['b'];
         $this->pdf->SetDrawColor($arraydata["r"], $arraydata["g"], $arraydata["b"]);
     } elseif ($arraydata["type"] == "SetLineWidth") {
         $this->pdf->SetLineWidth($arraydata["width"]);
     } elseif ($arraydata["type"] == "break") {
     } elseif ($arraydata["type"] == "Line") {
         $printline = false;
         if ($arraydata['printWhenExpression'] == "") {
             $printline = true;
         } else {
             $printline = $this->analyse_expression($arraydata['printWhenExpression']);
         }
         if ($printline) {
             $this->pdf->Line($arraydata["x1"] + $this->arrayPageSetting["leftMargin"], $arraydata["y1"] + $y_axis, $arraydata["x2"] + $this->arrayPageSetting["leftMargin"], $arraydata["y2"] + $y_axis, $arraydata["style"]);
         }
     } elseif ($arraydata["type"] == "SetFillColor") {
         $this->fillcolor_r = $arraydata['r'];
         $this->fillcolor_g = $arraydata['g'];
         $this->fillcolor_b = $arraydata['b'];
         $this->pdf->SetFillColor($arraydata["r"], $arraydata["g"], $arraydata["b"]);
     } elseif ($arraydata["type"] == "lineChart") {
         $this->showLineChart($arraydata, $y_axis);
     } elseif ($arraydata["type"] == "barChart") {
         $this->showBarChart($arraydata, $y_axis, 'barChart');
     } elseif ($arraydata["type"] == "pieChart") {
         $this->showPieChart($arraydata, $y_axis);
     } elseif ($arraydata["type"] == "stackedBarChart") {
         $this->showBarChart($arraydata, $y_axis, 'stackedBarChart');
     } elseif ($arraydata["type"] == "stackedAreaChart") {
         $this->showAreaChart($arraydata, $y_axis, $arraydata["type"]);
     } elseif ($arraydata["type"] == "Barcode") {
         $this->showBarcode($arraydata, $y_axis);
     } elseif ($arraydata["type"] == "CrossTab") {
         $this->showCrossTab($arraydata, $y_axis);
     }
 }
Example #6
0
 protected function btnPrint_Click()
 {
     if ($this->lstLabelStock->SelectedValue) {
         $this->lstLabelStock->Warning = "";
         set_time_limit(0);
         // If the user clicked Cancel button
         if ($_SESSION["intGeneratingStatus"] != -1) {
             // If the user clicked outside of the modal dialog
             if ($this->dlgPrintLabels->Visible && $this->dlgPrintLabels->Display) {
                 if ($this->intCurrentBarCodeLabel < count($this->strBarCodeArray)) {
                     array_push($this->strTablesBufferArray, $this->CreateTableByBarCodeArray());
                     $this->txtWarning->Text = "Please wait... PDF Generating: " . $_SESSION["intGeneratingStatus"] . "% Complete";
                     $this->txtWarning->Display = true;
                     $this->btnPrint->Enabled = true;
                     QApplication::ExecuteJavaScript("document.getElementById('" . $this->btnPrint->ControlId . "').click();");
                 } else {
                     include_once '../includes/php/tcpdf/config/lang/eng.php';
                     include_once '../includes/php/tcpdf/tcpdf.php';
                     $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true);
                     // Set document information
                     $pdf->SetCreator("Tracmor");
                     $pdf->SetAuthor("Tracmor");
                     $pdf->SetTitle("Bar Codes");
                     // Set PDF viewer preferences
                     $arrPreferences = array('PrintScaling' => 'None');
                     $pdf->setViewerPreferences($arrPreferences);
                     // Disable header and footer
                     $pdf->setPrintHeader(false);
                     $pdf->setPrintFooter(false);
                     // Disable auto page breaks
                     $pdf->SetAutoPageBreak(false);
                     // Set some language-dependent strings
                     $pdf->setLanguageArray($l);
                     // Set the color used for all drawing operations (lines, rectangles and cell borders).
                     $pdf->SetDrawColor(255);
                     // white
                     // Set Cell Padding
                     $pdf->SetCellPadding(0);
                     // Set Cell Spacing
                     $pdf->SetLineWidth(0);
                     // Initialize document
                     $pdf->AliasNbPages();
                     switch ($this->lstLabelStock->SelectedValue) {
                         case 1:
                             // Labels per row for Avery 6577 (5/8" x 3")
                             $pdf->SetFontSize(3);
                             $pdf->setCellHeightRatio(2.3);
                             // was 1.93
                             // Set margins
                             $pdf->SetMargins(12, 12, 12);
                             break;
                         case 2:
                             // Labels per row for Avery 6576 (1-1/4" x 1-3/4")
                             $pdf->SetFontSize(3);
                             $pdf->setCellHeightRatio(11.0);
                             // was 10.2
                             // Set margins
                             $pdf->SetMargins(10, 16, 10);
                             break;
                         default:
                             throw new QCallerException('Label Stock Not Provided');
                             break;
                     }
                     foreach ($this->strTablesBufferArray as $strTableBuffer) {
                         // add a page
                         $pdf->AddPage();
                         // output the HTML content
                         $pdf->writeHTML($strTableBuffer);
                     }
                     // Close and save PDF document
                     $pdf->Output(".." . __TRACMOR_TMP__ . "/" . $_SESSION['intUserAccountId'] . "_BarCodes.pdf", "F");
                     // Cleaning up
                     $this->btnCancel_Click();
                     // Uncheck all items but SelectAll checkbox
                     foreach ($this->GetAllControls() as $objControl) {
                         if (substr($objControl->ControlId, 0, 11) == 'chkSelected') {
                             $objControl->Checked = false;
                         }
                     }
                     $arrDataGridObjectNameId = $this->ctlSearchMenu->GetDataGridObjectNameId();
                     // Uncheck SelectAll checkbox
                     $this->ctlSearchMenu->{$arrDataGridObjectNameId}[0]->chkSelectAll->Checked = false;
                     // Open generated PDF in new window
                     QApplication::ExecuteJavaScript("window.open('.." . __TRACMOR_TMP__ . "/" . $_SESSION['intUserAccountId'] . "_BarCodes.pdf','Barcodes','resizeable,menubar=1,scrollbar=1,left=0,top=0,width=800,height=600');");
                 }
             } else {
                 // Cleaning up
                 $this->btnCancel_Click();
             }
         }
     } else {
         $this->lstLabelStock->Warning = "Please select one";
         $this->lstLabelStock->Enabled = true;
     }
 }
 public function printTableAsPdf()
 {
     global $CFG;
     define('K_PATH_CACHE', $CFG->dataroot . '/temp/');
     require_once gcr::webDir . 'lib/tcpdf/config/lang/eng.php';
     require_once gcr::webDir . 'lib/tcpdf/tcpdf.php';
     $app = $this->user->getApp();
     // create new PDF document
     $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
     // set document information
     $pdf->SetCreator($app->getFullName());
     $pdf->SetAuthor($app->getFullName());
     $pdf->SetTitle('Student Transcript');
     $pdf->SetSubject($this->user->getFullNameString());
     $pdf->SetKeywords('transcript, course, grade');
     $address = $app->getAddressObject();
     $person2 = $app->getPerson2Object();
     $header_string = $person2->getFullName() . "\n";
     $header_string .= $address->getStreet1() . "\n";
     if ($address->getStreet2() != '') {
         $header_string .= $address->getStreet2() . "\n";
     }
     $header_string .= $address->getCity() . ', ' . $address->getState() . ' ' . $address->getZipcode() . "\n";
     $header_string .= $person2->getPhone1() . "\n";
     $header_string .= $person2->getPhone2() . "\n";
     $header_string .= $person2->getEmail();
     // set default header data
     $pdf->SetHeaderData('../../../../../../..' . $app->getLogoFilePath(), 30, trim(trim($app->getFullName())) . ' Student Transcript', 'Student: ' . trim($this->user->getFullNameString()) . ', ' . $this->user->getObject()->email . "\nDate: " . date('m/d/Y', time()));
     // set header and footer fonts
     $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
     $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
     // set default monospaced font
     $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
     //set margins
     $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
     $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
     $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
     //set auto page breaks
     $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
     //set image scale factor
     $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
     //set some language-dependent strings
     $pdf->setLanguageArray($l);
     // ---------------------------------------------------------
     // set font
     $pdf->SetFont('helvetica', '', 8);
     // add a page
     $pdf->AddPage();
     $mdl_user_obj = $this->user->getObject();
     $html = '<b>Educational Provider Information:</b><br />';
     $html .= $app->getFullName() . '<br />';
     $html .= $person2->getFullName() . '<br />';
     $html .= $address->getStreet1() . '<br />';
     if ($address->getStreet2() != '') {
         $html .= $address->getStreet2() . "<br />";
     }
     $html .= $address->getCity() . ', ' . $address->getState() . ' ' . $address->getZipcode() . "<br />";
     $html .= $person2->getPhone1() . "<br />";
     $html .= $person2->getPhone2() . "<br />";
     $html .= $person2->getEmail() . '<br /><br />';
     $w = array(17, 65, 50, 12, 12, 23);
     $pdf->SetFillColor(255);
     $pdf->SetTextColor(0);
     // Data
     $fill = 0;
     $pdf->writeHTMLCell(array_sum($w), $h = 0, $x = '', $y = '', $html, $border = 0, $ln = 1, $fill = 0, $reseth = true, $align = '', $autopadding = true);
     $pdf->SetFont('helvetica', '', 8);
     $row_count = $this->table->getRowCount();
     $columns = $this->table->getColumns();
     // Colors, line width and bold font
     $pdf->SetFillColor(230, 238, 238);
     $pdf->SetDrawColor(221, 221, 221);
     $pdf->SetLineWidth(0.3);
     $pdf->SetFont('', 'B', 8);
     // Header
     $pdf->Cell($w[0], 7, 'Date', 1, 0, 'L', 1);
     $pdf->Cell($w[1], 7, 'Course', 1, 0, 'L', 1);
     $pdf->Cell($w[2], 7, 'Instructor', 1, 0, 'L', 1);
     $pdf->Cell($w[3], 7, 'Credits', 1, 0, 'L', 1);
     $pdf->Cell($w[4], 7, 'Grade', 1, 0, 'L', 1);
     $pdf->Cell($w[5], 7, 'Result', 1, 0, 'L', 1);
     $pdf->Ln();
     // Color and font restoration
     $pdf->SetFillColor(240, 240, 246);
     $pdf->SetFont('helvetica', '', 8);
     // Data
     $fill = 0;
     // This convoluted code does the following for each table row:
     // 1. Break the table row contents into a multidimentional
     // array, $row[column][line], so that we can handle cells
     // which require multiple lines because they are too long.
     // 2. Print each column left to right, and repeat for each line
     // required for this row.
     for ($row = 1; $row < $row_count; $row++) {
         $row_content = array();
         $max_line_index = 0;
         for ($column = 0; $column < 6; $column++) {
             $max_chars = floor(0.75 * $w[$column]);
             $cell_content = strip_tags($columns[$column]->getCells($row)->getContent());
             $column_line_count = ceil((strlen($cell_content) + 0.1) / $max_chars);
             if ($column_line_count - 1 > $max_line_index) {
                 $max_line_index = $column_line_count - 1;
             }
             for ($i = 0; $i < $column_line_count; $i++) {
                 $row_content[$column][$i] = substr($cell_content, $max_chars * $i, $max_chars);
             }
         }
         for ($i = 0; $i <= $max_line_index; $i++) {
             for ($column = 0; $column < 6; $column++) {
                 if (!isset($row_content[$column][$i])) {
                     $row_content[$column][$i] = '';
                 }
                 $pdf->Cell($w[$column], 6, $row_content[$column][$i], 'LR', 0, 'L', $fill);
             }
             $pdf->Ln();
         }
         $fill = !$fill;
     }
     $pdf->SetFont('helvetica', '', 7);
     $html = '*Note: This transcript may not include all course records for the specified user. Neither Globalclassroom Inc. nor the educational provider can verify the accuracy of the grades listed and cannot be held responsible for any usage of this document or the information provided therein.';
     $pdf->Cell(array_sum($w), 0, '', 'T');
     $pdf->Ln();
     $pdf->writeHTMLCell(array_sum($w), $h = 0, $x = '', $y = '', $html, $border = 0, $ln = 1, $fill = 0, $reseth = true, $align = '', $autopadding = true);
     // ---------------------------------------------------------
     //Close and output PDF document
     $pdf->Output('transcript.pdf', 'I');
 }
Example #8
0
$pdf->SetLineStyle($style5);
$pdf->SetFillColor(255, 0, 0);
$pdf->Arrow(200, 280, 185, 266, 0, 5, 15);
$pdf->Arrow(200, 280, 190, 263, 1, 5, 15);
$pdf->Arrow(200, 280, 195, 261, 2, 5, 15);
$pdf->Arrow(200, 280, 200, 260, 3, 5, 15);
// - . - . - . - . - . - . - . - . - . - . - . - . - . - . -
// ellipse
// add a page
$pdf->AddPage();
$pdf->Cell(0, 0, 'Arc of Ellipse');
// center of ellipse
$xc = 100;
$yc = 100;
// X Y axis
$pdf->SetDrawColor(200, 200, 200);
$pdf->Line($xc - 50, $yc, $xc + 50, $yc);
$pdf->Line($xc, $yc - 50, $xc, $yc + 50);
// ellipse axis
$pdf->SetDrawColor(200, 220, 255);
$pdf->Line($xc - 50, $yc - 50, $xc + 50, $yc + 50);
$pdf->Line($xc - 50, $yc + 50, $xc + 50, $yc - 50);
// ellipse
$pdf->SetDrawColor(200, 255, 200);
$pdf->Ellipse($xc, $yc, 30, 15, 45, 0, 360, 'D', array(), array(), 2);
// ellipse arc
$pdf->SetDrawColor(255, 0, 0);
$pdf->Ellipse($xc, $yc, 30, 15, 45, 45, 90, 'D', array(), array(), 2);
// ---------------------------------------------------------
//Close and output PDF document
$pdf->Output('example_012.pdf', 'I');
Example #9
0
// set some language-dependent strings (optional)
if (@file_exists(dirname(__FILE__) . '/lang/eng.php')) {
    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');
        /**
         * print PDF order
         * @param Order $order
         */
        private function printPDFOrder(Order $order){

            global $lang;
            $product_items = $order->getProducts();
            $shop = new ShopInfo($this->module_srl);
            $this->model->includeTCPDF();

            // create new PDF document
            $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, TRUE, 'UTF-8', FALSE);

            // set document information
            $pdf->SetCreator($shop->getShopTitle());
            $pdf->SetTitle(sprintf($lang->order_with_number, $order->order_srl));
            $pdf->SetSubject(sprintf($lang->order_with_number, $order->order_srl));

            $pdf->setPrintHeader(FALSE);
            $pdf->setPrintFooter(FALSE);

            // set font
            $pdf->SetFont('dejavusans', '', 10);

            // add a page
            $pdf->AddPage();


            // create HTML content
            $html = '
            <div style="float:left; text-align: center;">'.$shop->getShopTitle().'</div>
            <h1>'.sprintf($lang->order_with_number, $order->order_srl).'</h1>
            <p></p>
            Order date: '.zdate($order->regdate,'d-M-y').'
            <p></p><h3>'.$lang->shipping_address.'</h3>'.$order->shipping_address.'
            <p></p><h3>'.$lang->billing_address.'</h3>'.$order->billing_address.'
            <p></p><h3>'.$lang->payment_method_used.'</h3>'.ucwords(str_replace('_', ' ', $order->payment_method)).'
            <p></p><h3>'.$lang->shipping_method_used.'</h3>'.ucwords(str_replace('_', ' ', $order->shipping_method)).'
            <p></p><h3>'.$lang->items_ordered.'</h3></br>';

            // output the HTML content
            $pdf->writeHTML($html, TRUE, FALSE, TRUE, FALSE, '');

            // Colors, line width and bold font
            $pdf->SetFillColor(38, 74, 108);
            $pdf->SetTextColor(255);
            $pdf->SetDrawColor(38, 74, 108);
            $pdf->SetLineWidth(0.3);
            $pdf->SetFont('', 'B');
            // Header
            $w = array(15, 70, 20, 45, 45);
            $header= $header = array($lang->product_no_dot, $lang->title, $lang->quantity, $lang->price, $lang->subtotal);
            $num_headers = count($header);
            for($i = 0; $i < $num_headers; ++$i) {
                $pdf->Cell($w[$i], 7, $header[$i], 1, 0, 'C', 1);
            }
            $pdf->Ln();
            // Color and font restoration
            $pdf->SetFillColor(224, 235, 255);
            $pdf->SetTextColor(0);
            $pdf->SetFont('');
            // Data
            $fill = 0;
            $i = 0;
            foreach($product_items as $product){
                $i++;
                $pdf->Cell($w[0], 6, $i, 'LR', 0, 'C', $fill);
                $pdf->Cell($w[1], 6, $product->getTitle(), 'LR', 0, 'L', $fill);
                $pdf->Cell($w[2], 6, $product->getQuantity(), 'LR', 0, 'R', $fill);
                $pdf->Cell($w[3], 6, ShopDisplay::priceFormat($product->getPrice(), $shop->getCurrencySymbol()), 'LR', 0, 'R', $fill);
                $pdf->Cell($w[4], 6, ShopDisplay::priceFormat($product->getPrice() * $product->getQuantity(), $shop->getCurrencySymbol()), 'LR', 0, 'R', $fill);
                $pdf->Ln();
                $fill=!$fill;
            }

            $pdf->Cell(array_sum($w) - $w[4], 6, $lang->total, 1, 0, 'R',$fill);
            $pdf->Cell($w[4], 6, ShopDisplay::priceFormat($order->getTotalBeforeDiscount(), $shop->getCurrencySymbol()), 1, 0, 'R',$fill);
            $fill=!$fill;
            $pdf->Ln();

            if($order->getDiscountAmount()){
                $pdf->Cell(array_sum($w) - $w[4], 6, $lang->discount, 1, 0, 'R',$fill);
                $pdf->Cell($w[4], 6, ShopDisplay::priceFormat(-1 * $order->getDiscountAmount(), $shop->getCurrencySymbol()), 1, 0, 'R',$fill);
                $fill=!$fill;
                $pdf->Ln();
            }

            if($order->getShippingMethodName()){
                $pdf->Cell(array_sum($w) - $w[4], 6, $lang->shipping, 1, 0, 'R',$fill);
                $pdf->Cell($w[4], 6, ShopDisplay::priceFormat($order->getShippingCost(), $shop->getCurrencySymbol()), 1, 0, 'R',$fill);
                $fill=!$fill;
                $pdf->Ln();
            }

            $pdf->SetFont('', 'B');
            $pdf->Cell(array_sum($w) - $w[4], 6, $lang->grand_total, 1, 0, 'R',$fill);
            $pdf->Cell($w[4], 6, ShopDisplay::priceFormat($order->getTotal(), $shop->getCurrencySymbol()), 1, 0, 'R',$fill);
            $fill=!$fill;
            $pdf->Ln();
            $pdf->SetFont('');

            if($shop->showVAT()){
                $pdf->Cell(array_sum($w) - $w[4], 6, $lang->taxes, 1, 0, 'R',$fill);
                $pdf->Cell($w[4], 6, ShopDisplay::priceFormat($order->getVAT(), $shop->getCurrencySymbol()), 1, 0, 'R',$fill);
                $fill=!$fill;
                $pdf->Ln();
            }

            $pdf->Cell(array_sum($w), 0, '', 'T');


            //Close and output PDF document
            $pdf->Output(sprintf($lang->order_with_number, $order->order_srl), 'I');
        }
Example #11
0
    <td width="336"><p align="center">________________________________________</p>
    </td>
    <td width="320"><p align="center">________________________________________</p>
    </td>
  </tr>
  <tr>
    <td><div align="center">{$Aval1} - {$VarAval1}</div></td>
    <td><div align="center">{$Aval2} - {$VarAval2}</div></td>
  </tr>  
  <tr>
    <td colspan="2"><div align="center">
      <p align="justify">Este pagaré si no fuera pagado a su vencimiento causará INTERESES  a razón 1.00% MENSUAL por todo el tiempo que dure insoluto y está sujeto a COBRO  ANTICIPADO del saldo al no ser con PUNTUALIDAD cualquier abono especifico en  las CONDICIONES DEL CONTRATO.</p>
    </div>      </td>
  </tr>
</table>
EOD;
$pdf->writeHTML($tb12, true, false, false, false, '');
//ºººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººººº
$pdf->SetDrawColor(10);
//                   tamaño
//          x         x  y
$pdf->Rect(10, 40, 190, 90, 'D');
$pdf->SetDrawColor(0);
$pdf->SetDrawColor(10);
//                   tamaño
//          x         x  y
$pdf->Rect(10, 165, 190, 90, 'D');
$pdf->SetDrawColor(0);
//$pdf->RoundedRect(5, 255, 40, 30, 3.50, '1111', 'DF');
//Close and output PDF document
$pdf->Output('solicitud.pdf', 'I');
Example #12
0
require_once 'tcpdf/tcpdf.php';
// подключаем библиотеку
// создаем объект TCPDF - документ с размерами формата A4
// ориентация - книжная
// единицы измерения - миллиметры
// кодировка - UTF-8
$pdf = new TCPDF('L', 'mm', 'A4', true, 'UTF-8', false);
// убираем на всякий случай шапку и футер документа
// 	$pdf->setPageOrientation('Landscape'); //setPrintHeader(false);
$pdf->setPrintFooter(false);
$pdf->SetMargins(20, 25, 25);
// устанавливаем отступы (20 мм - слева, 25 мм - сверху, 25 мм - справа)
// 	$pdf->SetXY(90, 10);
// устанавливаем координаты вывода текста в рамке:
// 90 мм - отступ от левого края бумаги, 10 мм - от верхнего
$pdf->SetDrawColor(0, 0, 200);
// устанавливаем цвет рамки (синий)
$pdf->SetTextColor(0, 200, 0);
// устанавливаем цвет текста (зеленый)
// set cell padding
$pdf->setCellPaddings(1, 1, 1, 1);
// set cell margins
$pdf->setCellMargins(1, 1, 1, 1);
// set color for background
$pdf->SetFillColor(255, 255, 127);
$_SERVER['HTTP_REFERER'] = ';;;';
// отключаю срабатывание редиректа
require_once "params.php";
if (isset($_REQUEST['table'])) {
    $table = $_REQUEST['table'];
} else {
Example #13
0
 public function display($arraydata, $y_axis = 0, $fielddata = false)
 {
     //print_r($arraydata);echo "<br/>";
     //    $this->pdf->Cell(10,10,"SSSS");
     $this->Rotate($arraydata["rotation"]);
     if ($arraydata["rotation"] != "") {
         if ($arraydata["rotation"] == "Left") {
             $w = $arraydata["width"];
             $arraydata["width"] = $arraydata["height"];
             $arraydata["height"] = $w;
             $this->pdf->SetXY($this->pdf->GetX() - $arraydata["width"], $this->pdf->GetY());
         } elseif ($arraydata["rotation"] == "Right") {
             $w = $arraydata["width"];
             $arraydata["width"] = $arraydata["height"];
             $arraydata["height"] = $w;
             $this->pdf->SetXY($this->pdf->GetX(), $this->pdf->GetY() - $arraydata["height"]);
         } elseif ($arraydata["rotation"] == "UpsideDown") {
             //soverflow"=>$stretchoverflow,"poverflow"
             $arraydata["soverflow"] = true;
             $arraydata["poverflow"] = true;
             //   $w=$arraydata["width"];
             // $arraydata["width"]=$arraydata["height"];
             //$arraydata["height"]=$w;
             $this->pdf->SetXY($this->pdf->GetX() - $arraydata["width"], $this->pdf->GetY() - $arraydata["height"]);
         }
     }
     if ($arraydata["type"] == "SetFont") {
         if ($arraydata["font"] == 'uGB') {
             $this->pdf->isUnicode = true;
         } else {
             $this->pdf->isUnicode = false;
         }
         $this->pdf->SetFont($arraydata["font"], $arraydata["fontstyle"], $arraydata["fontsize"]);
     } elseif ($arraydata["type"] == "subreport") {
         $this->runSubReport($arraydata);
     } elseif ($arraydata["type"] == "MultiCell") {
         $currenty = $this->pdf->GetY();
         if ($fielddata == false) {
             if ($this->allowprintuntill >= $currenty) {
                 $this->checkoverflow($arraydata, $this->updatePageNo($arraydata["txt"]));
             }
         } elseif ($fielddata == true) {
             if ($this->allowprintuntill >= $currenty) {
                 $this->checkoverflow($arraydata, $this->updatePageNo($this->analyse_expression($arraydata["txt"], $arraydata["isPrintRepeatedValues"])));
             } elseif ($this->parentcurrentband == "detail") {
                 $this->pdf->Cell(40, 10, "SADSD");
             }
             //                  echo $arraydata["txt"]."+\"|(".$y_axis.",".print_r($arraydata,true)."),$this->allowprintuntill,$newy\"<br/><br/>";
         }
     } elseif ($arraydata["type"] == "SetXY") {
         $this->pdf->SetXY($arraydata["x"] + $this->arrayPageSetting["leftMargin"], $arraydata["y"] + $y_axis);
     } elseif ($arraydata["type"] == "Cell") {
         $currenty = $this->pdf->GetY();
         if ($this->allowprintuntill >= $currenty) {
             $this->pdf->Cell($arraydata["width"], $arraydata["height"], $this->updatePageNo($arraydata["txt"]), $arraydata["border"], $arraydata["ln"], $arraydata["align"], $arraydata["fill"], $arraydata["link"]);
         } elseif ($this->parentcurrentband == "detail") {
             $this->pdf->Cell(40, 10, "SADSD");
         }
     } elseif ($arraydata["type"] == "Rect") {
         $this->pdf->Rect($arraydata["x"] + $this->arrayPageSetting["leftMargin"], $arraydata["y"] + $y_axis, $arraydata["width"], $arraydata["height"]);
     } elseif ($arraydata["type"] == "Image") {
         $path = $this->analyse_expression($arraydata["path"]);
         $imgtype = substr($path, -3);
         if ($imgtype == 'jpg' || right($path, 3) == 'jpg' || right($path, 4) == 'jpeg') {
             $imgtype = "JPEG";
         } elseif ($imgtype == 'png' || $imgtype == 'PNG') {
             $imgtype = "PNG";
         }
         if (file_exists($path) || left($path, 4) == 'http') {
             $this->pdf->Image($path, $arraydata["x"] + $this->arrayPageSetting["leftMargin"], $arraydata["y"] + $y_axis, $arraydata["width"], $arraydata["height"], $imgtype, $arraydata["link"]);
         } elseif (left($path, 22) == "data:image/jpeg;base64") {
             $imgtype = "JPEG";
             $img = str_replace('data:image/jpeg;base64,', '', $path);
             $imgdata = base64_decode($img);
             $this->pdf->Image('@' . $imgdata, $arraydata["x"] + $this->arrayPageSetting["leftMargin"], $arraydata["y"] + $y_axis, $arraydata["width"], $arraydata["height"]);
             //,$imgtype,$arraydata["link"]);
         } elseif (left($path, 22) == "data:image/png;base64,") {
             $imgtype = "PNG";
             // $this->pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
             $img = str_replace('data:image/png;base64,', '', $path);
             $imgdata = base64_decode($img);
             $this->pdf->Image('@' . $imgdata, $arraydata["x"] + $this->arrayPageSetting["leftMargin"], $arraydata["y"] + $y_axis, $arraydata["width"], $arraydata["height"]);
             //,$imgtype,$arraydata["link"]);
         }
     } elseif ($arraydata["type"] == "SetTextColor") {
         $this->pdf->SetTextColor($arraydata["r"], $arraydata["g"], $arraydata["b"]);
     } elseif ($arraydata["type"] == "SetDrawColor") {
         $this->pdf->SetDrawColor($arraydata["r"], $arraydata["g"], $arraydata["b"]);
     } elseif ($arraydata["type"] == "SetLineWidth") {
         $this->pdf->SetLineWidth($arraydata["width"]);
     } elseif ($arraydata["type"] == "Line") {
         $this->pdf->Line($arraydata["x1"] + $this->arrayPageSetting["leftMargin"], $arraydata["y1"] + $y_axis, $arraydata["x2"] + $this->arrayPageSetting["leftMargin"], $arraydata["y2"] + $y_axis);
     } elseif ($arraydata["type"] == "SetFillColor") {
         $this->pdf->SetFillColor($arraydata["r"], $arraydata["g"], $arraydata["b"]);
     } elseif ($arraydata["type"] == "lineChart") {
         $this->showLineChart($arraydata, $y_axis);
     } elseif ($arraydata["type"] == "barChart") {
         $this->showBarChart($arraydata, $y_axis, 'barChart');
     } elseif ($arraydata["type"] == "stackedBarChart") {
         $this->showBarChart($arraydata, $y_axis, 'stackedBarChart');
     } elseif ($arraydata["type"] == "stackedAreaChart") {
         $this->showAreaChart($arraydata, $y_axis, $arraydata["type"]);
     } elseif ($arraydata["type"] == "Barcode") {
         $this->showBarcode($arraydata, $y_axis);
     }
 }
Example #14
0
    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 057');
        $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 . ' 057', PDF_HEADER_STRING);
        // set header and footer fonts
        $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
        $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
        // set default monospaced font
        $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
        // set margins
        $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
        $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
        $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
        // set auto page breaks
        $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
        // set image scale factor
        $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
        // set some language-dependent strings (optional)
        $pdf->setLanguageArray($this->langSettings);
        // ---------------------------------------------------------
        // set font
        $pdf->SetFont('helvetica', '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');
        $pdf->SetXY(15, 120);
        // text on bottom
        $pdf->Cell(30, 0, 'Top-Bottom', 1, $ln = 0, 'C', 0, '', 0, false, 'T', 'B');
        $pdf->Cell(30, 0, 'Center-Bottom', 1, $ln = 0, 'C', 0, '', 0, false, 'C', 'B');
        $pdf->Cell(30, 0, 'Bottom-Bottom', 1, $ln = 0, 'C', 0, '', 0, false, 'B', 'B');
        $pdf->Cell(30, 0, 'Ascent-Bottom', 1, $ln = 0, 'C', 0, '', 0, false, 'A', 'B');
        $pdf->Cell(30, 0, 'Baseline-Bottom', 1, $ln = 0, 'C', 0, '', 0, false, 'L', 'B');
        $pdf->Cell(30, 0, 'Descent-Bottom', 1, $ln = 0, 'C', 0, '', 0, false, 'D', 'B');
        // draw some reference lines
        $linestyle = array('width' => 0.1, 'cap' => 'butt', 'join' => 'miter', 'dash' => '', 'phase' => 0, 'color' => array(255, 0, 0));
        $pdf->Line(15, 60, 195, 60, $linestyle);
        $pdf->Line(15, 90, 195, 90, $linestyle);
        $pdf->Line(15, 120, 195, 120, $linestyle);
        // - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        // Print an image to explain cell measures
        $pdf->Image('tests/images/tcpdf_cell.png', 15, 160, 100, 100, 'PNG', '', '', false, 300, '', false, false, 0, false, false, false);
        $legend = 'LEGEND:

X: cell x top-left origin (top-right for RTL)
Y: cell y top-left origin (top-right for RTL)
CW: cell width
CH: cell height
LW: line width
NRL: normal line position
EXT: external line position
INT: internal line position
ML: margin left
MR: margin right
MT: margin top
MB: margin bottom
PL: padding left
PR: padding right
PT: padding top
PB: padding bottom
TW: text width
FA: font ascent
FB: font baseline
FD: font descent';
        $pdf->SetFont('helvetica', '', 10);
        $pdf->setCellHeightRatio(1.25);
        $pdf->MultiCell(0, 0, $legend, 0, 'L', false, 1, 125, 160, true, 0, false, true, 0, 'T', false);
        // - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        // CELL BORDERS
        // add a page
        $pdf->AddPage();
        $pdf->SetFont('helvetica', 'B', 20);
        $pdf->Write(0, 'Example of borders for Cell()', '', 0, 'L', true, 0, false, false, 0);
        $pdf->SetFont('helvetica', '', 11);
        // set border width
        $pdf->SetLineWidth(0.508);
        // set color for cell border
        $pdf->SetDrawColor(0, 128, 255);
        // set filling color
        $pdf->SetFillColor(255, 255, 128);
        // set cell height ratio
        $pdf->setCellHeightRatio(3);
        $pdf->Cell(30, 0, '1', 1, 1, 'C', 1, '', 0, false, 'T', 'C');
        $pdf->Ln(2);
        $pdf->Cell(30, 0, 'LTRB', 'LTRB', 1, 'C', 1, '', 0, false, 'T', 'C');
        $pdf->Ln(2);
        $pdf->Cell(30, 0, 'LTR', 'LTR', 1, 'C', 1, '', 0, false, 'T', 'C');
        $pdf->Ln(2);
        $pdf->Cell(30, 0, 'TRB', 'TRB', 1, 'C', 1, '', 0, false, 'T', 'C');
        $pdf->Ln(2);
        $pdf->Cell(30, 0, 'LRB', 'LRB', 1, 'C', 1, '', 0, false, 'T', 'C');
        $pdf->Ln(2);
        $pdf->Cell(30, 0, 'LTB', 'LTB', 1, 'C', 1, '', 0, false, 'T', 'C');
        $pdf->Ln(2);
        $pdf->Cell(30, 0, 'LT', 'LT', 1, 'C', 1, '', 0, false, 'T', 'C');
        $pdf->Ln(2);
        $pdf->Cell(30, 0, 'TR', 'TR', 1, 'C', 1, '', 0, false, 'T', 'C');
        $pdf->Ln(2);
        $pdf->Cell(30, 0, 'RB', 'RB', 1, 'C', 1, '', 0, false, 'T', 'C');
        $pdf->Ln(2);
        $pdf->Cell(30, 0, 'LB', 'LB', 1, 'C', 1, '', 0, false, 'T', 'C');
        $pdf->Ln(2);
        $pdf->Cell(30, 0, 'LR', 'LR', 1, 'C', 1, '', 0, false, 'T', 'C');
        $pdf->Ln(2);
        $pdf->Cell(30, 0, 'TB', 'TB', 1, 'C', 1, '', 0, false, 'T', 'C');
        $pdf->Ln(2);
        $pdf->Cell(30, 0, 'L', 'L', 1, 'C', 1, '', 0, false, 'T', 'C');
        $pdf->Ln(2);
        $pdf->Cell(30, 0, 'T', 'T', 1, 'C', 1, '', 0, false, 'T', 'C');
        $pdf->Ln(2);
        $pdf->Cell(30, 0, 'R', 'R', 1, 'C', 1, '', 0, false, 'T', 'C');
        $pdf->Ln(2);
        $pdf->Cell(30, 0, 'B', 'B', 1, 'C', 1, '', 0, false, 'T', 'C');
        // - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        // ADVANCED SETTINGS FOR CELL BORDERS
        // add a page
        $pdf->AddPage();
        $pdf->SetFont('helvetica', 'B', 20);
        $pdf->Write(0, 'Example of advanced border settings for Cell()', '', 0, 'L', true, 0, false, false, 0);
        $pdf->SetFont('helvetica', '', 11);
        // set border width
        $pdf->SetLineWidth(1);
        // set color for cell border
        $pdf->SetDrawColor(0, 128, 255);
        // set filling color
        $pdf->SetFillColor(255, 255, 128);
        $border = array('LTRB' => array('width' => 2, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(255, 0, 0)));
        $pdf->Cell(30, 0, 'LTRB', $border, 1, 'C', 1, '', 0, false, 'T', 'C');
        $pdf->Ln(5);
        $border = array('L' => array('width' => 2, 'cap' => 'square', 'join' => 'miter', 'dash' => 0, 'color' => array(255, 0, 0)), 'R' => array('width' => 2, 'cap' => 'square', 'join' => 'miter', 'dash' => 0, 'color' => array(255, 0, 255)), 'T' => array('width' => 2, 'cap' => 'square', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 255, 0)), 'B' => array('width' => 2, 'cap' => 'square', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 255)));
        $pdf->Cell(30, 0, 'LTRB', $border, 1, 'C', 1, '', 0, false, 'T', 'C');
        $pdf->Ln(5);
        $border = array('mode' => 'ext', 'LTRB' => array('width' => 2, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(255, 0, 0)));
        $pdf->Cell(30, 0, 'LTRB EXT', $border, 1, 'C', 1, '', 0, false, 'T', 'C');
        $pdf->Ln(5);
        $border = array('mode' => 'int', 'LTRB' => array('width' => 2, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(255, 0, 0)));
        $pdf->Cell(30, 0, 'LTRB INT', $border, 1, 'C', 1, '', 0, false, 'T', 'C');
        $pdf->Ln(5);
        // - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        // reset pointer to the last page
        $pdf->lastPage();
        // ---------------------------------------------------------
        $this->comparePdfs($pdf);
    }
    public function rekapitulasi_lahan_kecamatan_pdf($tahun, $periode)
    {
        /// 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('Dinas PU CKTR Sidoarjo');
        $pdf->SetTitle('Rekapitulasi_Lahan_Perkecamatan_Triwulan' . $periode . '_' . $tahun);
        $pdf->SetSubject('TCPDF');
        $pdf->SetKeywords('TCPDF, PDF');
        $pdf->SetHeaderData('sidoardjo.png', 20, 'PEMERINTAH KABUPATEN SIDOARDJO', 'DINAS PEKERJAAN UMUM CIPTA KARYA DAN TATA RUANG', 'REKAPITULASI DATA LAHAN PERUMAHAH / PEMUKIMAN');
        $pdf->setFooterData('Triwulan ' . $periode . ' Tahun ' . $tahun);
        $pdf->setBarcode(date('Y-m-d H:i:s'));
        // 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)
        if (@file_exists(dirname(__FILE__) . '/lang/eng.php')) {
            require_once dirname(__FILE__) . '/lang/eng.php';
            $pdf->setLanguageArray($l);
        }
        // ---------------------------------------------------------
        // set font
        $pdf->SetFont('helvetica', 'B', 20);
        // add a page
        $pdf->AddPage('L', 'A3');
        //  $pdf->Write(0, 'PEMBANGUNAN PERUMAHAN / PEMUKIMAN', '', 0, 'C', true, 0, false, false, 0);
        //  $pdf->Write(0, 'REKAPITULASI DATA LAHAN PERUMAHAH / PEMUKIMAN', '', 0, 'C', true, 0, false, false, 0);
        $pdf->SetFont('helvetica', '', 11);
        // $pdf->Write(0, 'Tahun :'  .$tahun, '', 0, 'L', true, 0, false, false, 0);
        //  $pdf->Write(0, 'Periode : Triwulan' .$periode, '', 0, 'L', true, 0, false, false, 0);
        $pdf->SetLineWidth(5);
        $pdf->SetDrawColor(0, 128, 255);
        $pdf->SetFillColor(255, 255, 128);
        // -----------------------------------------------------------------------------
        // -----------------------------------------------------------------------------
        $k['JML_IJIN_LOKASI'] = $k['LUAS'] = $k['RENCANA_TAPAK'] = $k['PEMBEBASAN'] = $k['TERBANGUN'] = $k['BELUM_TERBANGUN'] = $k['DIALOKASIKAN'] = $k['PEMBEBASAN'] = $k['DIMATANGKAN'] = $k['AKTIF_DLM_PEMBANGUNAN'] = $k['AKTIF_BERHENTI'] = $k['AKTIF_SDH_SELESAI'] = $k['TIDAK_AKTIF'] = 0;
        $tb = "";
        $this->load->model('m_report');
        $nilai = $this->m_report->jumlah_kecamatan();
        foreach ($nilai as $nil) {
            $jmlkec = $nil['JUMLAH'];
            $data['jumlah'] = $nil['JUMLAH'];
        }
        for ($j = 1; $j <= $jmlkec; $j++) {
            $data['lah_kec'][$j] = $this->m_report->tabel_lahan_kecamatan_all($j, $tahun, $periode);
            $data['aktifpemb'][$j] = $this->m_report->aktif_dalam_pembangunan($j, $tahun, $periode);
            $data['aktifber'][$j] = $this->m_report->aktif_berhenti($j, $tahun, $periode);
            $data['aktifsel'][$j] = $this->m_report->aktif_sdh_selesai($j, $tahun, $periode);
            $data['tdkaktif'][$j] = $this->m_report->tidak_aktif($j, $tahun, $periode);
        }
        for ($c = 1; $c < $jmlkec; $c++) {
            foreach ($data['lah_kec'][$c] as $i) {
                $tb .= "<tr>\n              <td width=\"28px\">" . $c . "</td>\n              <td width=\"100px\">" . $i['NAMA_KECAMATAN'] . "</td>              \n              <td width=\"87px\">" . $i['JML_IJIN_LOKASI'] . " </td>\n              <td width=\"87px\">" . $i['LUAS'] . " </td>\n              <td width=\"87px\">" . $i['RENCANA_TAPAK'] . " </td>\n              <td width=\"90px\">" . $i['PEMBEBASAN'] . " </td>\n              <td width=\"87px\">" . $i['TERBANGUN'] . " </td>\n              <td width=\"87px\">" . $i['BELUM_TERBANGUN'] . " </td>\n              <td width=\"90px\">" . $i['DIALOKASIKAN'] . " </td>\n              <td width=\"90px\">" . $i['PEMBEBASAN'] . " </td>\n              <td width=\"87px\">" . $i['DIMATANGKAN'] . " </td>";
                $k['JML_IJIN_LOKASI'] += $i['JML_IJIN_LOKASI'];
                $k['LUAS'] += $i['LUAS'];
                $k['RENCANA_TAPAK'] += $i['RENCANA_TAPAK'];
                $k['PEMBEBASAN'] += $i['PEMBEBASAN'];
                $k['TERBANGUN'] += $i['TERBANGUN'];
                $k['BELUM_TERBANGUN'] += $i['BELUM_TERBANGUN'];
                $k['DIALOKASIKAN'] += $i['DIALOKASIKAN'];
                $k['PEMBEBASAN'] += $i['PEMBEBASAN'];
                $k['DIMATANGKAN'] += $i['DIMATANGKAN'];
            }
            foreach ($data['aktifpemb'][$c] as $i) {
                $tb .= "<td width=\"87px\">" . $i['AKTIF_DLM_PEMBANGUNAN'] . "</td>";
                $k['AKTIF_DLM_PEMBANGUNAN'] += $i['AKTIF_DLM_PEMBANGUNAN'];
            }
            foreach ($data['aktifber'][$c] as $i) {
                $tb .= "<td width=\"87px\">" . $i['AKTIF_BERHENTI'] . " </td>";
                $k['AKTIF_BERHENTI'] += $i['AKTIF_BERHENTI'];
            }
            foreach ($data['aktifsel'][$c] as $i) {
                $tb .= "<td width=\"87px\">" . $i['AKTIF_SDH_SELESAI'] . " </td>";
                $k['AKTIF_SDH_SELESAI'] += $i['AKTIF_SDH_SELESAI'];
            }
            foreach ($data['tdkaktif'][$c] as $i) {
                $tb .= "<td width=\"87px\">" . $i['TIDAK_AKTIF'] . " </td>                            \n              </tr> ";
                $k['TIDAK_AKTIF'] += $i['TIDAK_AKTIF'];
            }
        }
        $tb1 = "";
        $tb1 .= "<tr>\n             \n              <td width=\"130px\">JUMLAH</td>\n              <td width=\"87px\">" . $k['JML_IJIN_LOKASI'] . " </td>\n              <td width=\"87px\">" . $k['LUAS'] . " </td>\n              <td width=\"87px\">" . $k['RENCANA_TAPAK'] . " </td>\n              <td width=\"90px\">" . $k['PEMBEBASAN'] . " </td>\n              <td width=\"87px\">" . $k['TERBANGUN'] . " </td>\n              <td width=\"87px\">" . $k['BELUM_TERBANGUN'] . " </td>\n              <td width=\"90px\">" . $k['DIALOKASIKAN'] . " </td>\n              <td width=\"90px\">" . $k['PEMBEBASAN'] . " </td>\n              <td width=\"87px\">" . $k['DIMATANGKAN'] . " </td>\n              <td width=\"87px\">" . $k['AKTIF_DLM_PEMBANGUNAN'] . " </td>\n              <td width=\"87px\">" . $k['AKTIF_BERHENTI'] . " </td>\n              <td width=\"87px\">" . $k['AKTIF_SDH_SELESAI'] . " </td>\n              <td width=\"87px\">" . $k['TIDAK_AKTIF'] . " </td>\n              \n            </tr> ";
        $tbl = <<<EOD
      <table border="1" cellpadding="2" cellspacing="2">
      <thead>
       <tr style="background-color:#FFFF00;color:#0000FF;">
        <td width="28px" align="center"><b>NO</b></td>
        <td width="100px" align="center"><b>Kecamatan</b></td>
        <td width="87px " align="center"> <b>Perusahaan</b></td>
        <td width="87px" align="center"><b>Nama Perumahaan</b></td>
        <td width="87px" align="center"><b>Nama Lokasi (Ha)</b></td>
        <td width="87px" align="center"><b>No Lokasi</b></td>
        <td width="87px" align="center"><b>Tanggal Lokasi Dimiliki</b></td>
        <td width="87px" align="center"><b>Luas Lokasi</b></td>
        <td width="87px" align="center"><b>Rencana Tapak</b></td>
        <td width="90px" align="center"><b>Pembebasan</b></td>
        <td width="87px" align="center"><b>Terbangun</b></td>
        <td width="87px" align="center"><b>Belum Terbangun</b></td>
        <td width="90px" align="center"><b>Dialokasikan</b></td>
        <td width="90px" align="center"><b>Pembebasan</b></td>
        <td width="87px" align="center"><b>Sudah Dimatangkan</b></td>
        
        

       </tr>
      </thead>
       {$tb} {$tb1}
      </table>
EOD;
        $pdf->writeHTML($tbl, true, false, false, false, '');
        $tb = "";
        $tb1 = "";
        $this->load->model('m_report');
        $data1 = $this->m_report->tabel_lahan_kecamatan_all_statistic($tahun - 1);
        $data2 = $this->m_report->tabel_lahan_kecamatan_all_statistic($tahun - 2);
        foreach ($data2 as $i) {
            $tb .= "<tr>  \n                                \n                  <td width=\"320px\">JUMLAH PENGEMBANG\n                  <br>JUMLAH IJIN LOKASI\n                  <br>LUAS IJIN LOKASI\n                  <br>RENCANA TAPAK\n                  <br>PEMBEBASAN\n                  <br>TERBANGUN\n                  <br>BELUM TERBANGUN\n                  </td>\n                  <td width=\"200px\">" . $i['JML_PENGEMBANG'] . "\n                  <br>" . $i['JML_IJIN_LOKASI'] . "\n                  <br>" . $i['LUAS'] . "\n                  <br>" . $i['RENCANA_TAPAK'] . "\n                  <br>" . $i['PEMBEBASAN'] . "\n                  <br>" . $i['TERBANGUN'] . "\n                  <br>" . $i['BELUM_TERBANGUN'] . "\n                  </td>";
        }
        foreach ($data1 as $i) {
            $tb .= "<td width=\"200px\">" . $i['JML_PENGEMBANG'] . "\n                  <br>" . $i['JML_IJIN_LOKASI'] . "\n                  <br>" . $i['LUAS'] . "\n                  <br>" . $i['RENCANA_TAPAK'] . "\n                  <br>" . $i['PEMBEBASAN'] . "\n                  <br>" . $i['TERBANGUN'] . "\n                  <br>" . $i['BELUM_TERBANGUN'] . "\n                  </td>      \n                </tr> ";
        }
        $th1 = $tahun - 1;
        $th2 = $tahun - 2;
        $tbl = <<<EOD
      <table border="1" cellpadding="2" cellspacing="2">
      <thead>
       <tr style="background-color:#FFFF00;color:#0000FF;">
        
        <td width="320px" align="center"><b>TYPE RUMAH</b></td>
        <td width="200px " align="center"> <b>DES {$th2}</b></td>     
        <td width="200px " align="center"> <b>DES {$th1}</b></td>
       </tr>
      </thead>
       {$tb} {$tb1}
      </table>
EOD;
        //print_r($tbl);
        $pdf->writeHTML($tbl, true, false, false, false, '');
        $pdf->Output('Rekapitulasi_Lahan_Perkecamatan_Triwulan' . $periode . '_' . $tahun . '.pdf', 'I');
    }
Example #16
0
 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 046');
     $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 . ' 046', PDF_HEADER_STRING);
     // set header and footer fonts
     $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
     $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
     // set default monospaced font
     $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
     // set margins
     $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
     $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
     $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
     // set auto page breaks
     $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
     // set image scale factor
     $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
     // set some language-dependent strings (optional)
     $pdf->setLanguageArray($this->langSettings);
     // ---------------------------------------------------------
     // set font
     $pdf->SetFont('helvetica', 'B', 20);
     // add a page
     $pdf->AddPage();
     $pdf->Write(0, 'Example of Text Hyphenation', '', 0, 'L', true, 0, false, false, 0);
     $pdf->Ln(10);
     /*
     Unicode Data for SHY:
         Name : SOFT HYPHEN, commonly abbreviated as SHY
         HTML Entity (decimal): &#173;
         HTML Entity (hex): &#xad;
         HTML Entity (named): &shy;
         How to type in Microsoft Windows: [Alt +00AD] or [Alt 0173]
         UTF-8 (hex): 0xC2 0xAD (c2ad)
     */
     /*
     // You can automatically add SOFT HYPHENS to your text using
     // the hyphenateText() method, but this requires either an
     // hyphenation pattern array of a hyphenation pattern TEX file.
     // You can download hyphenation TEX patterns from:
     // http://www.ctan.org/tex-archive/language/hyph-utf8/tex/generic/hyph-utf8/patterns/
     
     // EXAMPLE:
     
     $html = 'On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee the pain and trouble that are bound to ensue; and equal blame belongs to those who fail in their duty through weakness of will, which is the same as saying through shrinking from toil and pain. These cases are perfectly simple and easy to distinguish. In a free hour, when our power of choice is untrammelled and when nothing prevents our being able to do what we like best, every pleasure is to be welcomed and every pain avoided. But in certain circumstances and owing to the claims of duty or the obligations of business it will frequently occur that pleasures have to be repudiated and annoyances accepted. The wise man therefore always holds in these matters to this principle of selection: he rejects pleasures to secure other greater pleasures, or else he endures pains to avoid worse pains.';
     
     $hyphen_patterns = $pdf->getHyphenPatternsFromTEX('hyphens/hyph-en-gb.tex');
     
     $html = $pdf->hyphenateText($html, $hyphen_patterns, array(), 1, 2, 1, 8);
     */
     // HTML text with soft hyphens (&shy;)
     $html = 'On the other hand, we de&shy;nounce with righ&shy;teous in&shy;dig&shy;na&shy;tion and dis&shy;like men who are so be&shy;guiled and de&shy;mo&shy;r&shy;al&shy;ized by the charms of plea&shy;sure of the mo&shy;ment, so blind&shy;ed by de&shy;sire, that they can&shy;not fore&shy;see the pain and trou&shy;ble that are bound to en&shy;sue; and equal blame be&shy;longs to those who fail in their du&shy;ty through weak&shy;ness of will, which is the same as say&shy;ing through shrink&shy;ing from toil and pain. Th&shy;ese cas&shy;es are per&shy;fect&shy;ly sim&shy;ple and easy to distin&shy;guish. In a free hour, when our pow&shy;er of choice is un&shy;tram&shy;melled and when noth&shy;ing pre&shy;vents our be&shy;ing able to do what we like best, ev&shy;ery plea&shy;sure is to be wel&shy;comed and ev&shy;ery pain avoid&shy;ed. But in cer&shy;tain cir&shy;cum&shy;s&shy;tances and ow&shy;ing to the claims of du&shy;ty or the obli&shy;ga&shy;tions of busi&shy;ness it will fre&shy;quent&shy;ly oc&shy;cur that plea&shy;sures have to be re&shy;pu&shy;di&shy;at&shy;ed and an&shy;noy&shy;ances ac&shy;cept&shy;ed. The wise man there&shy;fore al&shy;ways holds in th&shy;ese mat&shy;ters to this prin&shy;ci&shy;ple of se&shy;lec&shy;tion: he re&shy;jects plea&shy;sures to se&shy;cure other greater plea&shy;sures, or else he en&shy;dures pains to avoid worse pains.';
     $pdf->SetFont('times', '', 10);
     $pdf->SetDrawColor(255, 0, 0);
     $pdf->SetTextColor(0, 63, 127);
     // print a cell
     $pdf->writeHTMLCell(50, 0, '', '', $html, 1, 1, 0, true, 'J');
     $this->comparePdfs($pdf);
 }
Example #17
0
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
//set auto page breaks
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
//set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
//set some language-dependent strings
$pdf->setLanguageArray($l);
// ---------------------------------------------------------
// set font
$pdf->SetFont('helvetica', "B", 12);
// add a page
$pdf->AddPage();
$pdf->SetLineWidth(1);
$pdf->SetDrawColor(50, 0, 0, 0);
$pdf->SetFillColor(100, 0, 0, 0);
$pdf->SetTextColor(100, 0, 0, 0);
$pdf->Rect(30, 60, 20, 20, 'DF');
$pdf->Text(30, 85, 'Cyan');
$pdf->SetDrawColor(0, 50, 0, 0);
$pdf->SetFillColor(0, 100, 0, 0);
$pdf->SetTextColor(0, 100, 0, 0);
$pdf->Rect(60, 60, 20, 20, 'DF');
$pdf->Text(60, 85, 'Magenta');
$pdf->SetDrawColor(0, 0, 50, 0);
$pdf->SetFillColor(0, 0, 100, 0);
$pdf->SetTextColor(0, 0, 100, 0);
$pdf->Rect(90, 60, 20, 20, 'DF');
$pdf->Text(90, 85, 'Yellow');
$pdf->SetDrawColor(0, 0, 0, 50);
Example #18
0
 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 013');
     $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 . ' 013', PDF_HEADER_STRING);
     // set header and footer fonts
     $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
     $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
     // set default monospaced font
     $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
     // set margins
     $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
     $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
     $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
     // set auto page breaks
     $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
     // set image scale factor
     $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
     // set some language-dependent strings (optional)
     $pdf->setLanguageArray($this->langSettings);
     // ---------------------------------------------------------
     // set font
     $pdf->SetFont('helvetica', 'B', 20);
     // add a page
     $pdf->AddPage();
     $pdf->Write(0, 'Graphic Transformations', '', 0, 'C', 1, 0, false, false, 0);
     // set font
     $pdf->SetFont('helvetica', '', 10);
     // --- Scaling ---------------------------------------------
     $pdf->SetDrawColor(200);
     $pdf->SetTextColor(200);
     $pdf->Rect(50, 70, 40, 10, 'D');
     $pdf->Text(50, 66, 'Scale');
     $pdf->SetDrawColor(0);
     $pdf->SetTextColor(0);
     // Start Transformation
     $pdf->StartTransform();
     // Scale by 150% centered by (50,80) which is the lower left corner of the rectangle
     $pdf->ScaleXY(150, 50, 80);
     $pdf->Rect(50, 70, 40, 10, 'D');
     $pdf->Text(50, 66, 'Scale');
     // Stop Transformation
     $pdf->StopTransform();
     // --- Translation -----------------------------------------
     $pdf->SetDrawColor(200);
     $pdf->SetTextColor(200);
     $pdf->Rect(125, 70, 40, 10, 'D');
     $pdf->Text(125, 66, 'Translate');
     $pdf->SetDrawColor(0);
     $pdf->SetTextColor(0);
     // Start Transformation
     $pdf->StartTransform();
     // Translate 7 to the right, 5 to the bottom
     $pdf->Translate(7, 5);
     $pdf->Rect(125, 70, 40, 10, 'D');
     $pdf->Text(125, 66, 'Translate');
     // Stop Transformation
     $pdf->StopTransform();
     // --- Rotation --------------------------------------------
     $pdf->SetDrawColor(200);
     $pdf->SetTextColor(200);
     $pdf->Rect(70, 100, 40, 10, 'D');
     $pdf->Text(70, 96, 'Rotate');
     $pdf->SetDrawColor(0);
     $pdf->SetTextColor(0);
     // Start Transformation
     $pdf->StartTransform();
     // Rotate 20 degrees counter-clockwise centered by (70,110) which is the lower left corner of the rectangle
     $pdf->Rotate(20, 70, 110);
     $pdf->Rect(70, 100, 40, 10, 'D');
     $pdf->Text(70, 96, 'Rotate');
     // Stop Transformation
     $pdf->StopTransform();
     // --- Skewing ---------------------------------------------
     $pdf->SetDrawColor(200);
     $pdf->SetTextColor(200);
     $pdf->Rect(125, 100, 40, 10, 'D');
     $pdf->Text(125, 96, 'Skew');
     $pdf->SetDrawColor(0);
     $pdf->SetTextColor(0);
     // Start Transformation
     $pdf->StartTransform();
     // skew 30 degrees along the x-axis centered by (125,110) which is the lower left corner of the rectangle
     $pdf->SkewX(30, 125, 110);
     $pdf->Rect(125, 100, 40, 10, 'D');
     $pdf->Text(125, 96, 'Skew');
     // Stop Transformation
     $pdf->StopTransform();
     // --- Mirroring horizontally ------------------------------
     $pdf->SetDrawColor(200);
     $pdf->SetTextColor(200);
     $pdf->Rect(70, 130, 40, 10, 'D');
     $pdf->Text(70, 126, 'MirrorH');
     $pdf->SetDrawColor(0);
     $pdf->SetTextColor(0);
     // Start Transformation
     $pdf->StartTransform();
     // mirror horizontally with axis of reflection at x-position 70 (left side of the rectangle)
     $pdf->MirrorH(70);
     $pdf->Rect(70, 130, 40, 10, 'D');
     $pdf->Text(70, 126, 'MirrorH');
     // Stop Transformation
     $pdf->StopTransform();
     // --- Mirroring vertically --------------------------------
     $pdf->SetDrawColor(200);
     $pdf->SetTextColor(200);
     $pdf->Rect(125, 130, 40, 10, 'D');
     $pdf->Text(125, 126, 'MirrorV');
     $pdf->SetDrawColor(0);
     $pdf->SetTextColor(0);
     // Start Transformation
     $pdf->StartTransform();
     // mirror vertically with axis of reflection at y-position 140 (bottom side of the rectangle)
     $pdf->MirrorV(140);
     $pdf->Rect(125, 130, 40, 10, 'D');
     $pdf->Text(125, 126, 'MirrorV');
     // Stop Transformation
     $pdf->StopTransform();
     // --- Point reflection ------------------------------------
     $pdf->SetDrawColor(200);
     $pdf->SetTextColor(200);
     $pdf->Rect(70, 160, 40, 10, 'D');
     $pdf->Text(70, 156, 'MirrorP');
     $pdf->SetDrawColor(0);
     $pdf->SetTextColor(0);
     // Start Transformation
     $pdf->StartTransform();
     // point reflection at the lower left point of rectangle
     $pdf->MirrorP(70, 170);
     $pdf->Rect(70, 160, 40, 10, 'D');
     $pdf->Text(70, 156, 'MirrorP');
     // Stop Transformation
     $pdf->StopTransform();
     // --- Mirroring against a straigth line described by a point (120, 120) and an angle -20°
     $angle = -20;
     $px = 120;
     $py = 170;
     // just for visualisation: the straight line to mirror against
     $pdf->SetDrawColor(200);
     $pdf->Line($px - 1, $py - 1, $px + 1, $py + 1);
     $pdf->Line($px - 1, $py + 1, $px + 1, $py - 1);
     $pdf->StartTransform();
     $pdf->Rotate($angle, $px, $py);
     $pdf->Line($px - 5, $py, $px + 60, $py);
     $pdf->StopTransform();
     $pdf->SetDrawColor(200);
     $pdf->SetTextColor(200);
     $pdf->Rect(125, 160, 40, 10, 'D');
     $pdf->Text(125, 156, 'MirrorL');
     $pdf->SetDrawColor(0);
     $pdf->SetTextColor(0);
     //Start Transformation
     $pdf->StartTransform();
     //mirror against the straight line
     $pdf->MirrorL($angle, $px, $py);
     $pdf->Rect(125, 160, 40, 10, 'D');
     $pdf->Text(125, 156, 'MirrorL');
     //Stop Transformation
     $pdf->StopTransform();
     $this->comparePdfs($pdf);
 }
Example #19
0
 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 022');
     $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 . ' 022', 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);
     // ---------------------------------------------------------
     // check also the following methods:
     // SetDrawColorArray()
     // SetFillColorArray()
     // SetTextColorArray()
     // set font
     $pdf->SetFont('helvetica', 'B', 18);
     // add a page
     $pdf->AddPage();
     $pdf->Write(0, 'Example of CMYK, RGB and Grayscale colours', '', 0, 'L', true, 0, false, false, 0);
     // define style for border
     $border_style = array('all' => array('width' => 2, 'cap' => 'square', 'join' => 'miter', 'dash' => 0, 'phase' => 0));
     // --- CMYK ------------------------------------------------
     $pdf->SetDrawColor(50, 0, 0, 0);
     $pdf->SetFillColor(100, 0, 0, 0);
     $pdf->SetTextColor(100, 0, 0, 0);
     $pdf->Rect(30, 60, 30, 30, 'DF', $border_style);
     $pdf->Text(30, 92, 'Cyan');
     $pdf->SetDrawColor(0, 50, 0, 0);
     $pdf->SetFillColor(0, 100, 0, 0);
     $pdf->SetTextColor(0, 100, 0, 0);
     $pdf->Rect(70, 60, 30, 30, 'DF', $border_style);
     $pdf->Text(70, 92, 'Magenta');
     $pdf->SetDrawColor(0, 0, 50, 0);
     $pdf->SetFillColor(0, 0, 100, 0);
     $pdf->SetTextColor(0, 0, 100, 0);
     $pdf->Rect(110, 60, 30, 30, 'DF', $border_style);
     $pdf->Text(110, 92, 'Yellow');
     $pdf->SetDrawColor(0, 0, 0, 50);
     $pdf->SetFillColor(0, 0, 0, 100);
     $pdf->SetTextColor(0, 0, 0, 100);
     $pdf->Rect(150, 60, 30, 30, 'DF', $border_style);
     $pdf->Text(150, 92, 'Black');
     // --- RGB -------------------------------------------------
     $pdf->SetDrawColor(255, 127, 127);
     $pdf->SetFillColor(255, 0, 0);
     $pdf->SetTextColor(255, 0, 0);
     $pdf->Rect(30, 110, 30, 30, 'DF', $border_style);
     $pdf->Text(30, 142, 'Red');
     $pdf->SetDrawColor(127, 255, 127);
     $pdf->SetFillColor(0, 255, 0);
     $pdf->SetTextColor(0, 255, 0);
     $pdf->Rect(70, 110, 30, 30, 'DF', $border_style);
     $pdf->Text(70, 142, 'Green');
     $pdf->SetDrawColor(127, 127, 255);
     $pdf->SetFillColor(0, 0, 255);
     $pdf->SetTextColor(0, 0, 255);
     $pdf->Rect(110, 110, 30, 30, 'DF', $border_style);
     $pdf->Text(110, 142, 'Blue');
     // --- GRAY ------------------------------------------------
     $pdf->SetDrawColor(191);
     $pdf->SetFillColor(127);
     $pdf->SetTextColor(127);
     $pdf->Rect(30, 160, 30, 30, 'DF', $border_style);
     $pdf->Text(30, 192, 'Gray');
     $this->comparePdfs($pdf);
 }
Example #20
0
 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 026');
     $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 . ' 026', PDF_HEADER_STRING);
     // set header and footer fonts
     $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
     $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
     // set default monospaced font
     $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
     // set margins
     $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
     $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
     $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
     // set auto page breaks
     $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
     // set image scale factor
     $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
     // set some language-dependent strings (optional)
     $pdf->setLanguageArray($this->langSettings);
     // ---------------------------------------------------------
     // set font
     $pdf->SetFont('helvetica', '', 22);
     // add a page
     $pdf->AddPage();
     // set color for text stroke
     $pdf->SetDrawColor(255, 0, 0);
     $pdf->setTextRenderingMode($stroke = 0, $fill = true, $clip = false);
     $pdf->Write(0, 'Fill text', '', 0, '', true, 0, false, false, 0);
     $pdf->setTextRenderingMode($stroke = 0.2, $fill = false, $clip = false);
     $pdf->Write(0, 'Stroke text', '', 0, '', true, 0, false, false, 0);
     $pdf->setTextRenderingMode($stroke = 0.2, $fill = true, $clip = false);
     $pdf->Write(0, 'Fill, then stroke text', '', 0, '', true, 0, false, false, 0);
     $pdf->setTextRenderingMode($stroke = 0, $fill = false, $clip = false);
     $pdf->Write(0, 'Neither fill nor stroke text (invisible)', '', 0, '', true, 0, false, false, 0);
     // * * * CLIPPING MODES  * * * * * * * * * * * * * * * * * *
     $pdf->StartTransform();
     $pdf->setTextRenderingMode($stroke = 0, $fill = true, $clip = true);
     $pdf->Write(0, 'Fill text and add to path for clipping', '', 0, '', true, 0, false, false, 0);
     $pdf->Image('tests/images/image_demo.jpg', 15, 65, 170, 10, '', '', '', true, 72);
     $pdf->StopTransform();
     $pdf->StartTransform();
     $pdf->setTextRenderingMode($stroke = 0.3, $fill = false, $clip = true);
     $pdf->Write(0, 'Stroke text and add to path for clipping', '', 0, '', true, 0, false, false, 0);
     $pdf->Image('tests/images/image_demo.jpg', 15, 75, 170, 10, '', '', '', true, 72);
     $pdf->StopTransform();
     $pdf->StartTransform();
     $pdf->setTextRenderingMode($stroke = 0.3, $fill = true, $clip = true);
     $pdf->Write(0, 'Fill, then stroke text and add to path for clipping', '', 0, '', true, 0, false, false, 0);
     $pdf->Image('tests/images/image_demo.jpg', 15, 85, 170, 10, '', '', '', true, 72);
     $pdf->StopTransform();
     $pdf->StartTransform();
     $pdf->setTextRenderingMode($stroke = 0, $fill = false, $clip = true);
     $pdf->Write(0, 'Add text to path for clipping', '', 0, '', true, 0, false, false, 0);
     $pdf->Image('tests/images/image_demo.jpg', 15, 95, 170, 10, '', '', '', true, 72);
     $pdf->StopTransform();
     // reset text rendering mode
     $pdf->setTextRenderingMode($stroke = 0, $fill = true, $clip = false);
     // * * * HTML MODE * * * * * * * * * * * * * * * * * * * * *
     // The following attributes were added to HTML:
     // stroke : stroke width
     // strokecolor : stroke color
     // fill : true (default) to fill the font, false otherwise
     // create some HTML content with text rendering modes
     $html = '<span stroke="0" fill="true">HTML Fill text</span><br />';
     $html .= '<span stroke="0.2" fill="false">HTML Stroke text</span><br />';
     $html .= '<span stroke="0.2" fill="true" strokecolor="#FF0000" color="#FFFF00">HTML Fill, then stroke text</span><br />';
     $html .= '<span stroke="0" fill="false">HTML Neither fill nor stroke text (invisible)</span><br />';
     // output the HTML content
     $pdf->writeHTML($html, true, 0, true, 0);
     $this->comparePdfs($pdf);
 }
Example #21
0
//set some language-dependent strings
$pdf->setLanguageArray($l);
// ---------------------------------------------------------
// check also the following methods:
// SetDrawColorArray()
// SetFillColorArray()
// SetTextColorArray()
// set font
$pdf->SetFont('helvetica', 'B', 18);
// add a page
$pdf->AddPage();
$pdf->Write(0, 'Example of CMYK, RGB and Grayscale colours', '', 0, 'L', true, 0, false, false, 0);
// define style for border
$border_style = array('all' => array('width' => 2, 'cap' => 'square', 'join' => 'miter', 'dash' => 0, 'phase' => 0));
// --- CMYK ------------------------------------------------
$pdf->SetDrawColor(50, 0, 0, 0);
$pdf->SetFillColor(100, 0, 0, 0);
$pdf->SetTextColor(100, 0, 0, 0);
$pdf->Rect(30, 60, 30, 30, 'DF', $border_style);
$pdf->Text(30, 92, 'Cyan');
$pdf->SetDrawColor(0, 50, 0, 0);
$pdf->SetFillColor(0, 100, 0, 0);
$pdf->SetTextColor(0, 100, 0, 0);
$pdf->Rect(70, 60, 30, 30, 'DF', $border_style);
$pdf->Text(70, 92, 'Magenta');
$pdf->SetDrawColor(0, 0, 50, 0);
$pdf->SetFillColor(0, 0, 100, 0);
$pdf->SetTextColor(0, 0, 100, 0);
$pdf->Rect(110, 60, 30, 30, 'DF', $border_style);
$pdf->Text(110, 92, 'Yellow');
$pdf->SetDrawColor(0, 0, 0, 50);
Example #22
0
function CreatePDF($mysqli, $otchet)
{
    //    $rus = array('А', 'Б', 'В', 'Г', 'Д', 'Е', 'Ё', 'Ж', 'З', 'И', 'Й', 'К', 'Л', 'М', 'Н', 'О', 'П', 'Р', 'С', 'Т', 'У', 'Ф', 'Х', 'Ц', 'Ч', 'Ш', 'Щ', 'Ъ', 'Ы', 'Ь', 'Э', 'Ю', 'Я', 'а', 'б', 'в', 'г', 'д', 'е', 'ё', 'ж', 'з', 'и', 'й', 'к', 'л', 'м', 'н', 'о', 'п', 'р', 'с', 'т', 'у', 'ф', 'х', 'ц', 'ч', 'ш', 'щ', 'ъ', 'ы', 'ь', 'э', 'ю', 'я');
    //    $lat = array('A', 'B', 'V', 'G', 'D', 'E', 'E', 'Gh', 'Z', 'I', 'Y', 'K', 'L', 'M', 'N', 'O', 'P', 'R', 'S', 'T', 'U', 'F', 'H', 'C', 'Ch', 'Sh', 'Sch', 'Y', 'Y', 'Y', 'E', 'Yu', 'Ya', 'a', 'b', 'v', 'g', 'd', 'e', 'e', 'gh', 'z', 'i', 'y', 'k', 'l', 'm', 'n', 'o', 'p', 'r', 's', 't', 'u', 'f', 'h', 'c', 'ch', 'sh', 'sch', 'y', 'y', 'y', 'e', 'yu', 'ya');
    //set document properties
    $pdf = new TCPDF('P', 'mm', 'A4', true, 'utf-8');
    $pdf->SetMargins(20, 30, 20);
    $pdf->AddPage();
    $pdf->SetFont('dejavusans', "", 10);
    $pdf->SetTitle($otchet);
    $pdf->SetXY(20, 50);
    $pdf->SetDrawColor(100, 100, 0);
    $pdf->SetTextColor(0, 0, 0);
    $pdf->SetDisplayMode('real', 'default');
    //insert an image and make it a link
    ///$pdf->Image('logo.png',10,20,33,0,' ','http://www.fpdf.org/');
    //display the title with a border around it
    $pdf->SetXY(50, 20);
    $pdf->Cell(130, 10, $otchet, 1, 0, 'C', 0);
    if ($otchet == 'Отчет по Ключевым словам') {
        $pdf->SetXY(50, 50);
        $pdf->SetFontSize(12);
        $pdf->MultiCell(40, 12, 'Номер категории', 1, 'C', 0);
        $pdf->SetXY(90, 50);
        $pdf->MultiCell(50, 12, 'Категория', 1, 'C', 0);
        $pdf->SetXY(140, 50);
        $pdf->MultiCell(40, 12, 'Количество просмотров', 1, 'C', 0);
        ///Таблица статистики
        $search = array();
        $s = $mysqli->prepare("SELECT * FROM Category1 ORDER BY stat");
        $s->execute();
        $result = $s->get_result();
        $y = 62;
        while ($obj = $result->fetch_assoc()) {
            $pdf->SetXY(50, $y);
            $pdf->SetFontSize(10);
            $pdf->MultiCell(40, 20, $obj['id'] . "_1", 1, 'C', 0);
            $pdf->SetXY(90, $y);
            $pdf->MultiCell(50, 20, $obj['categ'], 1, 'C', 0);
            $pdf->SetXY(140, $y);
            $pdf->MultiCell(40, 20, $obj['stat'], 1, 'C', 0);
            $y += 20;
        }
        $s = $mysqli->prepare("SELECT * FROM Category2 ORDER BY stat");
        $s->execute();
        $result = $s->get_result();
        while ($obj = $result->fetch_assoc()) {
            $pdf->SetXY(50, $y);
            $pdf->SetFontSize(10);
            $pdf->MultiCell(40, 20, $obj['id2'] . "_2", 1, 'C', 0);
            $pdf->SetXY(90, $y);
            $pdf->MultiCell(50, 20, $obj['categ2'], 1, 'C', 0);
            $pdf->SetXY(140, $y);
            $pdf->MultiCell(40, 20, $obj['stat'], 1, 'C', 0);
            $y += 20;
        }
    } else {
        $pdf->SetXY(30, 50);
        $pdf->SetFontSize(12);
        $pdf->MultiCell(40, 10, 'Номер новости', 1, 'C', 0);
        $pdf->SetXY(70, 50);
        $pdf->MultiCell(50, 10, 'Заголовок новости', 1, 'C', 0);
        $pdf->SetXY(120, 50);
        $pdf->MultiCell(40, 10, 'Категория', 1, 'C', 0);
        $pdf->SetXY(160, 50);
        $pdf->MultiCell(30, 10, 'Статистика', 1, 'C', 0);
        ///Таблица статистики
        $sth = $mysqli->prepare("SELECT * FROM News,Category2 WHERE News.id_cat2 = Category2.id2");
        $sth->execute();
        $result = $sth->get_result();
        $y = 60;
        while ($obj = $result->fetch_assoc()) {
            $pdf->SetXY(30, $y);
            $pdf->SetFontSize(10);
            $pdf->MultiCell(40, 20, $obj['id'], 1, 'C', 0);
            $pdf->SetXY(70, $y);
            $pdf->MultiCell(50, 20, $obj['title'] . '...', 1, 'C', 0);
            $pdf->SetXY(120, $y);
            $pdf->MultiCell(40, 20, $obj['categ2'], 1, 'C', 0);
            $pdf->SetXY(160, $y);
            $pdf->MultiCell(30, 20, $obj['colview'], 1, 'C', 0);
            $y += 20;
        }
    }
    //Output the document
    $pdf->OutPut('otchet.pdf');
}
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
//set auto page breaks
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
//set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
//set some language-dependent strings
$pdf->setLanguageArray($l);
// ---------------------------------------------------------
// set font
$pdf->SetFont('helvetica', '', 22);
// add a page
$pdf->AddPage();
// set color for text stroke
$pdf->SetDrawColor(255, 0, 0);
$pdf->setTextRenderingMode($stroke = 0, $fill = true, $clip = false);
$pdf->Write(0, 'Fill text', '', 0, '', true, 0, false, false, 0);
$pdf->setTextRenderingMode($stroke = 0.2, $fill = false, $clip = false);
$pdf->Write(0, 'Stroke text', '', 0, '', true, 0, false, false, 0);
$pdf->setTextRenderingMode($stroke = 0.2, $fill = true, $clip = false);
$pdf->Write(0, 'Fill, then stroke text', '', 0, '', true, 0, false, false, 0);
$pdf->setTextRenderingMode($stroke = 0, $fill = false, $clip = false);
$pdf->Write(0, 'Neither fill nor stroke text (invisible)', '', 0, '', true, 0, false, false, 0);
// * * * CLIPPING MODES  * * * * * * * * * * * * * * * * * *
$pdf->StartTransform();
$pdf->setTextRenderingMode($stroke = 0, $fill = true, $clip = true);
$pdf->Write(0, 'Fill text and add to path for clipping', '', 0, '', true, 0, false, false, 0);
$pdf->Image('../images/image_demo.jpg', 15, 65, 170, 10, '', '', '', true, 72);
$pdf->StopTransform();
$pdf->StartTransform();
Example #24
0
// set font
$pdf->SetFont('helvetica', '', 12);
// add a page
$pdf->AddPage();
$txt = 'You can set the transparency of PDF objects using the setAlpha() method.';
$pdf->Write(0, $txt, '', 0, '', true, 0, false, false, 0);
/*
 * setAlpha() gives transparency support. You can set the
 * alpha channel from 0 (fully transparent) to 1 (fully
 * opaque). It applies to all elements (text, drawings,
 * images).
 */
$pdf->SetLineWidth(2);
// draw opaque red square
$pdf->SetFillColor(255, 0, 0);
$pdf->SetDrawColor(127, 0, 0);
$pdf->Rect(30, 40, 60, 60, 'DF');
// set alpha to semi-transparency
$pdf->SetAlpha(0.5);
// draw green square
$pdf->SetFillColor(0, 255, 0);
$pdf->SetDrawColor(0, 127, 0);
$pdf->Rect(50, 60, 60, 60, 'DF');
// draw blue square
$pdf->SetFillColor(0, 0, 255);
$pdf->SetDrawColor(0, 0, 127);
$pdf->Rect(70, 80, 60, 60, 'DF');
// draw jpeg image
$pdf->Image('images/image_demo.jpg', 90, 100, 60, 60, '', 'http://www.tcpdf.org', '', true, 72);
// restore full opacity
$pdf->SetAlpha(1);
Example #25
0
//set auto page breaks
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
//set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
//set some language-dependent strings
$pdf->setLanguageArray($l);
// ---------------------------------------------------------
// set font
$pdf->SetFont('helvetica', 'B', 20);
// add a page
$pdf->AddPage();
$pdf->Write(0, 'Graphic Transformations', '', 0, 'C', 1, 0, false, false, 0);
// set font
$pdf->SetFont('helvetica', '', 10);
// --- Scaling ---------------------------------------------
$pdf->SetDrawColor(200);
$pdf->SetTextColor(200);
$pdf->Rect(50, 70, 40, 10, 'D');
$pdf->Text(50, 66, 'Scale');
$pdf->SetDrawColor(0);
$pdf->SetTextColor(0);
// Start Transformation
$pdf->StartTransform();
// Scale by 150% centered by (50,80) which is the lower left corner of the rectangle
$pdf->ScaleXY(150, 50, 80);
$pdf->Rect(50, 70, 40, 10, 'D');
$pdf->Text(50, 66, 'Scale');
// Stop Transformation
$pdf->StopTransform();
// --- Translation -----------------------------------------
$pdf->SetDrawColor(200);
 /**
  *   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');
     }
 }