Index: branches/5.1.x/core/units/pdf/pdf_renderer_tcpdf.php =================================================================== diff -u -N -r12127 -r12657 --- branches/5.1.x/core/units/pdf/pdf_renderer_tcpdf.php (.../pdf_renderer_tcpdf.php) (revision 12127) +++ branches/5.1.x/core/units/pdf/pdf_renderer_tcpdf.php (.../pdf_renderer_tcpdf.php) (revision 12657) @@ -1,6 +1,6 @@ IncludeTCPDF(); - + $this->PDF = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true); $this->PDF->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); $this->PDF->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); $this->PDF->setPrintHeader(false); $this->PDF->setPrintFooter(false); $this->PDF->AddPage(); - + // $this->PDF->SetX(50); // $this->PDF->SetY(200); // $this->PDF->wr } - + function IncludeTCPDF() { static $included = false; @@ -88,26 +90,26 @@ $included = true; } } - + function NextPage() { $this->PDF->AddPage(); } - + function GetWidth() { return $this->PDF->getPageWidth(); } - + function GetHeight() { return $this->PDF->getPageHeight(); } - + function SetFont($family, $size, $weight=400, $style='normal', $variant='normal') { $this->CurFontSize = $size; - + $family = strtolower($family); switch ($family) { case 'serif': @@ -127,19 +129,19 @@ $font = 'FreeSans'; break; } - + $bold = $weight >= 700 ? 'B' : ''; $italic = preg_match('/italic|oblique/i', $style) ? 'I' : ''; - + return $this->PDF->SetFont($font, $bold.$italic, $size); } - + function SetFontSize($size) { $this->CurFontSize = $size; $this->PDF->SetFontSize($size); } - + function ProcessHTMLColor($color) { $mapping = array( 'maroon' => '#800000', @@ -173,30 +175,30 @@ return array(255,255,0); } - + function SetFillColor($color) { list($r,$g,$b) = $this->ProcessHTMLColor($color); $this->PDF->SetFillColor($r,$g,$b); $this->PDF->SetTextColor($r,$g,$b); } - + function SetLineColor($color) { list($r,$g,$b) = $this->ProcessHTMLColor($color); return $this->PDF->SetDrawColor($r,$g,$b); } - - function SetLineWidth($width) + + function SetLineWidth($width) { return $this->PDF->setLineWidth($width); } - + function DrawLine($x1, $y1, $x2, $y2) { return $this->PDF->Line($x1, $y1, $x2, $y2); } - + function DrawRectangle($x1, $y1, $x2, $y2, $mode='D') { switch ($mode) { @@ -209,18 +211,18 @@ case kPDFRenderer::SHAPE_DRAW_FILL_AND_STROKE : $mode = 'DF'; break; - + } $w = $x2-$x1; $h = $y2-$y1; return $this->PDF->Rect($x1, $y1, $w, $h, $mode); } - + function DrawText($text, $x, $y) { return $this->PDF->text($x, $y, $text); } - + function DrawImage($filepath, $x, $y, $w=0, $h=0) { $info = pathinfo($filepath); @@ -237,36 +239,36 @@ $im = @imagecreatefromgif ($filepath); imagepng($im, $converted_filepath); } - + return $this->PDF->Image($converted_filepath, $x, $y, $w, $h); } } - + function GetPDFString() { return $this->PDF->Output('', 'S'); } - + function GetAscent() { //$this->CurrentFont['desc'] $font = $this->PDF->GetFont(); return ($font['desc']['Ascent'] / 1000) * $this->CurFontSize; } - + function GetDescent() { $font = $this->PDF->GetFont(); return ($font['desc']['Descent'] / 1000) * $this->CurFontSize; } - + function GetLineGap() { return 0; $font = $this->PDF->GetFont(); return (($font['Ascent'] - $font['Descent'])*0 / 1000) * $this->CurFontSize; } - + function GetStringWidth($string) { return $this->PDF->GetStringWidth($string);