X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=reporting%2Fincludes%2Fclass.pdf.inc;h=fb4cbf62d8f3425611e6718669e776da4e74522e;hb=d8582e452b443b4cb363c3d02d2b45a65de5a3b5;hp=0bf38d8f1756f9d0dc7532e6b76540d734a16a6a;hpb=c2e4edb8bd1eb60893f042f562bf2b817f06fd81;p=fa-stable.git diff --git a/reporting/includes/class.pdf.inc b/reporting/includes/class.pdf.inc index 0bf38d8f..fb4cbf62 100644 --- a/reporting/includes/class.pdf.inc +++ b/reporting/includes/class.pdf.inc @@ -63,9 +63,9 @@ include_once (dirname(__FILE__).'/fpdi/fpdi.php'); class Cpdf extends FPDI { - function Cpdf($pageSize='A4', $lang=null, $pageOrientation='P') + function __construct($pageSize='A4', $lang=null, $pageOrientation='P') { - $this->TCPDF($pageOrientation, 'pt', $pageSize);//, $uni, $enc); + parent::__construct($pageOrientation, 'pt', $pageSize);//, $uni, $enc); $this->SetLang($lang); $this->setPrintHeader(false); $this->setPrintFooter(false); @@ -79,21 +79,23 @@ class Cpdf extends FPDI { */ function SetLang($code=null) { - global $installed_languages, $dflt_lang, $path_to_root, $local_path_to_root; + global $installed_languages, $dflt_lang, $path_to_root, $local_path_to_root, $GetText; if (!$code) $code = $dflt_lang; + else + install_hooks($code); $lang = array_search_value($code, $installed_languages, 'code'); - $_SESSION['get_text']->set_language($lang['code'], strtoupper($lang['encoding'])); + $GetText->set_language($lang['code'], strtoupper($lang['encoding'])); // $local_path_to_root is set inside find_custom_file. // Select extension domain if po file is provided // otherwise use global translation. if (file_exists($local_path_to_root.'/lang/'.$lang['code'].'/LC_MESSAGES/'.$lang['code'].'.po')) - $_SESSION['get_text']->add_domain($lang['code'], $local_path_to_root . "/lang"); + $GetText->add_domain($lang['code'], $local_path_to_root . "/lang"); else - $_SESSION['get_text']->add_domain($lang['code'], $path_to_root . "/lang", @$lang['version']); + $GetText->add_domain($lang['code'], $path_to_root . "/lang", @$lang['version']); // re-read translated sys names. include($path_to_root.'/includes/sysnames.inc'); @@ -120,7 +122,6 @@ class Cpdf extends FPDI { $this->FontFamily = 'helvetica'; $this->FontStyle = ''; $this->FontSizePt = 12; -// $this->utf8Bidi(array("")); } @@ -175,7 +176,14 @@ class Cpdf extends FPDI { default : $fontname = "freesans5"; break; } } - // else use built-in adobe fonts helvetica. + elseif ($this->encoding === "ISO-8859-13") + { + switch ($this->l['a_meta_language']) + { + default : $fontname = "freesans13"; break; + } + } + // else use built-in adobe fonts helvetica. } $this->SetFont($fontname, $style); } @@ -251,7 +259,7 @@ class Cpdf extends FPDI { * nSeg is not allowed to be less than 2, as this will simply draw a line (and will even draw a * pretty crappy shape at 2, as we are approximating with bezier curves. */ - function ellipse($x0,$y0,$r1,$r2=0,$angle=0,$nSeg=8,$astart=0,$afinish=360,$close=1,$fill=0) + function ellipse($x0,$y0,$r1,$r2=0,$angle=0,$nSeg=8,$astart=0,$afinish=360,$close=1,$fill=0, $dummy=null) { parent::Ellipse($x0, $y0, $r1, $r2, $angle, $astart. $afinish, ($close?'C':''), "", "", $nSeg); } @@ -300,20 +308,30 @@ class Cpdf extends FPDI { $align = 'J'; } else - $align = 'R'; + { + if ($align == 'right') + $align = 'R';// This may need to be 'L' + elseif ($align == 'left') + $align = 'R'; + elseif ($align == 'center') + $align = 'C'; + elseif ($align == 'justify') + $align = 'J'; + } + $txt = parent::unhtmlentities($txt); // If horizontal scaling was requested, check to see if we're trying to scale // too much. If so, cut back string first and then scale it. $maxScaleFactor = 1.4; if ($stretch == 1 || $stretch == 2) - $txt = $this->calcTextWrap($txt, $w * $maxScaleFactor, $spacebreak); + $txt = $this->calcTextWrap($txt, $w * $maxScaleFactor, $spacebreak); // Wrap text if stretching isn't turned on else - $txt = $this->calcTextWrap($txt, $w, $spacebreak); + $txt = $this->calcTextWrap($txt, $w, $spacebreak); $ret = $txt[1]; $txt = $txt[0]; $this->SetXY($xb, $this->h - $yb - $h); - $txt = parent::unhtmlentities($txt); + if ($this->isunicode && $this->encoding != "UTF-8") $txt = iconv($this->encoding, "UTF-8", $txt); $this->Cell($w, $h, $txt, $border, 0, $align, $fill, $link, $stretch); @@ -327,4 +345,3 @@ class Cpdf extends FPDI { } // end of class -?> \ No newline at end of file