Add php files

This commit is contained in:
2025-05-12 15:44:39 +00:00
parent c951760058
commit 82d5804ac4
9534 changed files with 2638137 additions and 0 deletions

429
include/Sugarpdf/FontManager.php Executable file
View File

@@ -0,0 +1,429 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
require_once("include/Sugarpdf/sugarpdf_config.php");
class FontManager{
/**
* Contain all the errors generated during the process of FontManager
* @var String[]
*/
var $errors = array();
/**
* store the log string when addFont is call
* @var String
*/
var $log = "";
/**
* Current font filename
* @var String
*/
var $filename = "";
/**
* Current font file path
* @var String
*/
var $fontPath = "";
/**
* Multidimentional array which contain all the detail of all the available fonts
* @var Array
*/
var $fontList = array();
/**
* Name of the font of the current font file
* @var String
*/
var $font_name = "";
/**
* Encoding of the current font
* @var String
*/
var $font_enc = "";
/**
* Display name of the current font
* @var String
*/
var $font_displayname = "";
/**
* Type of the current font
* @var String
*/
var $font_type = "";
private function setFontPath(){
if(file_exists(K_PATH_CUSTOM_FONTS.$this->filename)){
$this->fontPath = K_PATH_CUSTOM_FONTS;
}else if(file_exists(K_PATH_FONTS.$this->filename)){
$this->fontPath = K_PATH_FONTS;
}else{
$this->fontPath = "";
array_push($this->errors, "Unable to find the font!");
}
}
/**
* This method return a boolean which describe if the font define
* in filename is embedded or not.
* @return boolean true if embedded.
*/
private function getEmbedded(){
if(empty($this->fontList[$this->getFilenameShort()]['type'])){
if(!$this->loadFontFile()){
array_push($this->errors, translate('ERR_LOADFONTFILE', 'Configurator'));
return false;
}
}
if($this->font_type == "cidfont0" || $this->font_type == "core"){
return false;
}
return true;
}
/**
* This method return the style of the given font set in filename
* Values can be regular, bold, italic.
* @return array of styles on success
* @return empty array on failure
*/
private function getStyle(){
if(empty($this->filename)){
array_push($this->errors, translate("ERR_FONT_EMPTYFILE","Configurator"));
return array();
}
if(preg_match("/bi.php$/i",$this->filename)){
return array("bold","italic");
}else if(preg_match("/ib.php$/i",$this->filename)){
return array("bold","italic");
}else if(preg_match("/b.php$/i",$this->filename)){
return array("bold");
}else if(preg_match("/i.php$/i",$this->filename)){
return array("italic");
}else{
return array("regular");
}
}
/**
* This method calculate the font size of $this->filename in KB
* .php file + .z file + .ctg.z file
* @return Integer font Size in KB
*/
private function getFontSize(){
$fileSize=filesize($this->fontPath.$this->filename);
$name = substr($this->filename, 0, strrpos($this->filename, '.'));
if(file_exists($this->fontPath.$name.".z")){
$fileSize+=filesize($this->fontPath.$name.".z");
}
if(file_exists($this->fontPath.$name.".ctg.z")){
$fileSize+=filesize($this->fontPath.$name.".ctg.z");
}
return round($fileSize/1024);
}
/**
* Fill the fontList attribute with the data contains in the font file.
*/
public function getDetail(){
if($this->loadFontFile()){
$this->fontList[$this->getFilenameShort()]['filename'] = $this->filename;
$this->fontList[$this->getFilenameShort()]['fontpath'] = $this->fontPath;
if(!empty($this->font_name)){
$this->fontList[$this->getFilenameShort()]['name'] = $this->font_name;
}else{
$this->fontList[$this->getFilenameShort()]['name'] = $this->getFilenameShort();
}
if(!empty($this->font_displayname)){
$this->fontList[$this->getFilenameShort()]['displayname'] = $this->font_displayname;
}
if(!empty($this->font_enc)){
$this->fontList[$this->getFilenameShort()]['enc'] = $this->font_enc;
}
if(!empty($this->font_type)){
if ($this->font_type == 'cidfont0' || $this->font_type == 'core' || $this->font_type == 'TrueType' || $this->font_type == 'Type1' || $this->font_type == 'TrueTypeUnicode') {
$this->fontList[$this->getFilenameShort()]['type'] = $this->font_type;
}else{
array_push($this->errors, translate("ERR_FONT_UNKNOW_TYPE","Configurator") . " " . $this->font_type);
}
}
$this->fontList[$this->getFilenameShort()]['style'] = $this->getStyle();
$this->fontList[$this->getFilenameShort()]['filesize'] = $this->getFontSize();
$this->fontList[$this->getFilenameShort()]['embedded'] = $this->getEmbedded();
return true;
}
return false;
}
/**
* This method load the font file and check if it is good formatted.
* @return boolean true on success
*/
private function loadFontFile(){
if(empty($this->filename))
return false;
$this->setFontPath();
if(!file_exists($this->fontPath.$this->filename)){
return false;
}
@include($this->fontPath.$this->filename);
if ((!isset($type)) OR (!isset($cw))) {
//The font definition file has a bad format
return false;
}
$this->font_name = "";
$this->font_enc = "";
$this->font_displayname = "";
$this->font_type = "";
if(!empty($name)){
$this->font_name = $name;
}
if(!empty($enc)){
$this->font_enc = $enc;
}
if(!empty($displayname)){
$this->font_displayname = $displayname;
}
if(!empty($type)){
$this->font_type = $type;
}
return true;
}
/**
* This method parse the font path defined in the sugarpdf config file
* and fill the fontList
* @return boolean true if font files have been found
*/
private function parseFolder(){
if(!file_exists(K_PATH_FONTS) || !is_dir(K_PATH_FONTS)){
array_push($this->errors, translate("ERR_NO_FONT_PATH","Configurator"));
return false;
}
$result[0] = scandir(K_PATH_FONTS);
if(file_exists(K_PATH_CUSTOM_FONTS) && is_dir(K_PATH_CUSTOM_FONTS)){
$result[1] = scandir(K_PATH_CUSTOM_FONTS);
}
foreach($result as $v){
foreach($v as $vv){
if(preg_match("/.php$/i",$vv)){
$this->filename = $vv;
$this->getDetail();
}
}
}
ksort($this->fontList);
if(count($this->fontList)>0){
return true;
}else{
return false;
}
}
/**
* This method fill the fontList with all the fonts available
*/
public function listFontFiles(){
$this->fontList=array();
if(file_exists($GLOBALS['sugar_config']['cache_dir']."/Sugarpdf/cachedFontList.php")){
require($GLOBALS['sugar_config']['cache_dir']."/Sugarpdf/cachedFontList.php");
$this->fontList=$cachedFontList;
return true;
}else{
if($this->parseFolder()){
$cacheDir = create_cache_directory('Sugarpdf/');
write_array_to_file('cachedFontList', $this->fontList, $cacheDir . 'cachedFontList.php');
return true;
}
}
return false;
}
/**
* This method generate an array of font which can be use with get_select_options_with_id
* @return Array
*/
public function getSelectFontList(){
$returnArray = array();
if($this->listFontFiles()){
foreach($this->fontList as $k=>$v){
if(!empty($v['displayname'])){
$returnArray[$k]=$v['displayname'];
}else{
$returnArray[$k]=$v['name'];
}
}
}
return $returnArray;
}
/**
* This method return the filename without the ".php"
* @return String The short filename
*/
private function getFilenameShort(){
return preg_replace("/.php$/i", "",$this->filename);
}
/**
* This method delete all the files related to the font define in the filename attribute.
* @return boolean true on success
*/
public function deleteFont(){
global $current_user;
if(!is_admin($current_user)){
sugar_die('Admin Only');
}
$this->loadFontFile();
if($this->font_type == "core" || $this->fontPath == K_PATH_FONTS){
array_push($this->errors, translate("ERR_DELETE_CORE_FILE","Configurator"));
return false;
}
if(file_exists($this->fontPath.$this->filename)){
if(is_writable($this->fontPath.$this->filename)){
unlink($this->fontPath.$this->filename);
if(file_exists($this->fontPath.$this->getFilenameShort().".ctg.z") && is_writable($this->fontPath.$this->getFilenameShort().".ctg.z")){
unlink($this->fontPath.$this->getFilenameShort()."ctg.z");
}
if(file_exists($this->fontPath.$this->getFilenameShort().".z") && is_writable($this->fontPath.$this->getFilenameShort().".z")){
unlink($this->fontPath.$this->getFilenameShort().".z");
}
$this->clearCachedFile();
return true;
}else{
array_push($this->errors, $this->fontPath.$this->filename . " " . translate("ERR_FONT_NOT_WRITABLE","Configurator"));
}
}else{
array_push($this->errors, $this->fontPath . " " . translate("ERR_FONT_FILE_DO_NOT_EXIST","Configurator"));
}
return false;
}
/**
* This method add a font to SugarCRM from a font file and a metric file using MakeFont()
* @param $font_file string
* @param $metric_file string
* @param $embedded boolean
* @param $encoding_table string
* @param $patch array
* @param $cid_info string
* @param $style string
* @return boolean true on success
* @see MakeFont() in K_PATH_FONTS/utils
*/
public function addFont($font_file, $metric_file, $embedded=true, $encoding_table='cp1252', $patch=array(), $cid_info="", $style="regular"){
global $current_user;
if(!is_admin($current_user)){
sugar_die('Admin Only');
}
$error=false;
$oldStr=ob_get_contents();
ob_clean();
require_once("include/tcpdf/fonts/utils/makefont.php");
$filename = MakeFont($font_file,$metric_file, $embedded, $encoding_table, $patch, $cid_info);
unlink($font_file);
unlink($metric_file);
$this->log=ob_get_contents();
ob_clean();
echo $oldStr;
if(empty($filename)){
array_push($this->errors, translate("ERR_FONT_MAKEFONT","Configurator"));
$error=true;
}else{
require_once("include/utils/file_utils.php");
$this->filename = basename($filename.".php");
if(!$this->loadFontFile()){
if(!mkdir_recursive(K_PATH_CUSTOM_FONTS)){
array_push($this->errors, "Error : Impossible to create the custom font directory.");
$error=true;
}else{
$styleLetter="";
switch($style){
case "italic":
$styleLetter="i";break;
case "bold":
$styleLetter="b";break;
case "boldItalic":
$styleLetter="bi";break;
default:
$styleLetter="";
}
sugar_rename($filename.".php", K_PATH_CUSTOM_FONTS.basename($filename.$styleLetter.".php"));
$this->log .= "\n" . translate("LBL_FONT_MOVE_DEFFILE","Configurator") . K_PATH_CUSTOM_FONTS.basename($filename.$styleLetter.".php");
if(file_exists($filename.".z")){
sugar_rename($filename.".z", K_PATH_CUSTOM_FONTS.basename($filename.$styleLetter.".z"));
$this->log .= "\n" . translate("LBL_FONT_MOVE_FILE","Configurator") . K_PATH_CUSTOM_FONTS.basename($filename.$styleLetter.".z");
}
if(file_exists($filename.".ctg.z")){
sugar_rename($filename.".ctg.z", K_PATH_CUSTOM_FONTS.basename($filename.$styleLetter.".ctg.z"));
$this->log .= "\n" . translate("LBL_FONT_MOVE_FILE","Configurator") . K_PATH_CUSTOM_FONTS.basename($filename.$styleLetter.".ctg.z");
}
}
}else{
array_push($this->errors, "\n".translate("ERR_FONT_ALREADY_EXIST","Configurator"));
$error=true;
}
if($error){
if(file_exists($filename.".php"))
unlink($filename.".php");
if(file_exists($filename.".ctg.z"))
unlink($filename.".ctg.z");
if(file_exists($filename.".z"))
unlink($filename.".z");
}
}
$this->clearCachedFile();
return $error;
}
/**
* This method delete the cached file cachedFontList.php
* @return boolean
*/
public function clearCachedFile(){
global $current_user;
if(!is_admin($current_user)){
sugar_die('Admin Only');
}
if(file_exists($GLOBALS['sugar_config']['cache_dir']."/Sugarpdf/cachedFontList.php")){
return(unlink($GLOBALS['sugar_config']['cache_dir']."/Sugarpdf/cachedFontList.php"));
}
return true;
}
/**
* Check if the given font filename exist in the font directories
* @return boolean
*/
public function fontFileExist($filename){
$this->filename = $filename;
return $this->loadFontFile();
}
}
?>

657
include/Sugarpdf/Sugarpdf.php Executable file
View File

@@ -0,0 +1,657 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
if(file_exists('custom/include/Sugarpdf/sugarpdf_config.php')){
require_once('custom/include/Sugarpdf/sugarpdf_config.php');
} else {
require_once('include/Sugarpdf/sugarpdf_config.php');
}
require_once('include/tcpdf/tcpdf.php');
require_once('include/Sugarpdf/SugarpdfHelper.php');
class Sugarpdf extends TCPDF
{
/**
* This array is meant to hold an objects/data that we would like to pass between
* the controller and the view. The bean will automatically be set for us, but this
* is meant to hold anything else.
*/
var $sugarpdf_object_map = array();
/**
* The name of the current module.
*/
var $module = '';
/**
* The name of the current action.
*/
var $action = '';
/**
*/
var $bean = null;
/**
* Any errors that occured this can either be set by the view or the controller or the model
*/
var $errors = array();
/**
* Use to set the filename of the output pdf file.
*/
var $fileName = PDF_FILENAME;
/**
* Use for the ACL access.
*/
var $aclAction = PDF_ACL_ACCESS;
/**
* Constructor which will peform the setup.
*/
function __construct($bean = null, $sugarpdf_object_map = array(),$orientation=PDF_PAGE_ORIENTATION, $unit=PDF_UNIT, $format=PDF_PAGE_FORMAT, $unicode=true, $encoding='UTF-8', $diskcache=false){
global $locale;
// $encoding = $locale->getExportCharset();
if(empty($encoding)){
$encoding = "UTF-8";
}
parent::__construct($orientation,$unit,$format,$unicode,$encoding,$diskcache);
$this->module = $GLOBALS['module'];
$this->bean = &$bean;
$this->sugarpdf_object_map = $sugarpdf_object_map;
if(!empty($_REQUEST["sugarpdf"])){
$this->action = $_REQUEST["sugarpdf"];
}
}
/**
* This method will be called from the controller and is not meant to be overridden.
*/
function process(){
$this->preDisplay();
$this->display();
}
/**
* This method will display the errors on the page.
*/
function displayErrors(){
foreach($this->errors as $error) {
echo '<span class="error">' . $error . '</span><br>';
}
}
/**
* [OVERRIDE] - This method is meant to overidden in a subclass. The purpose of this method is
* to allow a view to do some preprocessing before the display method is called. This becomes
* useful when you have a view defined at the application level and then within a module
* have a sub-view that extends from this application level view. The application level
* view can do the setup in preDisplay() that is common to itself and any subviews
* and then the subview can just override display(). If it so desires, can also override
* preDisplay().
*/
function preDisplay(){
// set document information
$this->SetCreator(PDF_CREATOR);
$this->SetAuthor(PDF_AUTHOR);
$this->SetTitle(PDF_TITLE);
$this->SetSubject(PDF_SUBJECT);
$this->SetKeywords(PDF_KEYWORDS);
// set other properties
$compression=false;
if(PDF_COMPRESSION == "on"){
$compression=true;
}
$this->SetCompression($compression);
$protection=array();
if(PDF_PROTECTION != ""){
$protection=explode(",",PDF_PROTECTION);
}
$this->SetProtection($protection,blowfishDecode(blowfishGetKey('sugarpdf_pdf_user_password'), PDF_USER_PASSWORD),blowfishDecode(blowfishGetKey('sugarpdf_pdf_owner_password'), PDF_OWNER_PASSWORD));
$this->setCellHeightRatio(K_CELL_HEIGHT_RATIO);
$this->setJPEGQuality(intval(PDF_JPEG_QUALITY));
$this->setPDFVersion(PDF_PDF_VERSION);
// set default header data
$this->setHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING);
// set header and footer fonts
$this->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
$this->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
//set margins
$this->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$this->setHeaderMargin(PDF_MARGIN_HEADER);
$this->setFooterMargin(PDF_MARGIN_FOOTER);
//set auto page breaks
$this->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
//set image scale factor
$this->setImageScale(PDF_IMAGE_SCALE_RATIO);
//set some language-dependent strings
//$this->setLanguageArray($l);
// ---------------------------------------------------------
}
/**
* [OVERRIDE] - This method is meant to overidden in a subclass.
*/
function display(){
$this->AddPage();
$this->SetFont(PDF_FONT_NAME_MAIN,'B',16);
$this->MultiCell(0,0,'Tcpdf class for this module and action has not been implemented.',0,'C');
$this->Info();
}
/**
* [OVERRIDE]
* This method override the regular Header() method to enable the custom image directory in addition to the OOB image directory.
* This method is used to render the page header.
* It is automatically called by AddPage().
* @access public
* @see include/tcpdf/TCPDF#Header()
*/
public function Header() {
$ormargins = $this->getOriginalMargins();
$headerfont = $this->getHeaderFont();
$headerdata = $this->getHeaderData();
if (($headerdata['logo']) AND ($headerdata['logo'] != K_BLANK_IMAGE)) {
// START SUGARPDF
$logo = K_PATH_CUSTOM_IMAGES.$headerdata['logo'];
$imsize = @getimagesize($logo);
if ($imsize === FALSE) {
// encode spaces on filename
$logo = str_replace(' ', '%20', $logo);
$imsize = @getimagesize($logo);
if ($imsize === FALSE) {
$logo = K_PATH_IMAGES.$headerdata['logo'];
}
}
// END SUGARPDF
$this->Image($logo, $this->GetX(), $this->getHeaderMargin(), $headerdata['logo_width']);
$imgy = $this->getImageRBY();
} else {
$imgy = $this->GetY();
}
$cell_height = round(($this->getCellHeightRatio() * $headerfont[2]) / $this->getScaleFactor(), 2);
// set starting margin for text data cell
if ($this->getRTL()) {
$header_x = $ormargins['right'] + ($headerdata['logo_width'] * 1.1);
} else {
$header_x = $ormargins['left'] + ($headerdata['logo_width'] * 1.1);
}
$this->SetTextColor(0, 0, 0);
// header title
$this->SetFont($headerfont[0], 'B', $headerfont[2] + 1);
$this->SetX($header_x);
$this->Cell(0, $cell_height, $headerdata['title'], 0, 1, '', 0, '', 0);
// header string
$this->SetFont($headerfont[0], $headerfont[1], $headerfont[2]);
$this->SetX($header_x);
$this->MultiCell(0, $cell_height, $headerdata['string'], 0, '', 0, 1, '', '', true, 0, false);
// print an ending header line
$this->SetLineStyle(array('width' => 0.85 / $this->getScaleFactor(), 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0)));
$this->SetY((2.835 / $this->getScaleFactor()) + max($imgy, $this->GetY()));
if ($this->getRTL()) {
$this->SetX($ormargins['right']);
} else {
$this->SetX($ormargins['left']);
}
$this->Cell(0, 0, '', 'T', 0, 'C');
}
/**
* [OVERRIDE] SetFont method in TCPDF Library
* This method override the regular SetFont() method to enable the custom font directory in addition to the OOB font directory.
*
* @param string $family Family font. It can be either a name defined by AddFont() or one of the standard Type1 families (case insensitive):<ul><li>times (Times-Roman)</li><li>timesb (Times-Bold)</li><li>timesi (Times-Italic)</li><li>timesbi (Times-BoldItalic)</li><li>helvetica (Helvetica)</li><li>helveticab (Helvetica-Bold)</li><li>helveticai (Helvetica-Oblique)</li><li>helveticabi (Helvetica-BoldOblique)</li><li>courier (Courier)</li><li>courierb (Courier-Bold)</li><li>courieri (Courier-Oblique)</li><li>courierbi (Courier-BoldOblique)</li><li>symbol (Symbol)</li><li>zapfdingbats (ZapfDingbats)</li></ul> It is also possible to pass an empty string. In that case, the current family is retained.
* @param string $style Font style. Possible values are (case insensitive):<ul><li>empty string: regular</li><li>B: bold</li><li>I: italic</li><li>U: underline</li><li>D: line trough</li></ul> or any combination. The default value is regular. Bold and italic styles do not apply to Symbol and ZapfDingbats basic fonts or other fonts when not defined.
* @param float $size Font size in points. The default value is the current size. If no size has been specified since the beginning of the document, the value taken is 12
* @param string $fontfile The font definition file. By default, the name is built from the family and style, in lower case with no spaces.
* @access public
* @see include/tcpdf/TCPDF#SetFont()
*/
public function SetFont($family, $style='', $size=0, $fontfile='') {
if(empty($fontfile)){
// This will force addFont to search the custom directory for font before the OOB directory
$fontfile = K_PATH_CUSTOM_FONTS."phantomFile.phantom";
}
parent::SetFont($family, $style, $size, $fontfile);
}
function Info(){
$this->SetFont(PDF_FONT_NAME_MAIN,'',12);
$this->MultiCell(0,0,'---',0,'L');
$this->MultiCell(0,0,'Class: '.get_class($this),0,'L');
$this->MultiCell(0,0,'Extends: '.get_parent_class($this),0,'L');
$this->MultiCell(0,0,'---',0,'L');
$this->MultiCell(0,0,'Module: '.$this->module,0,'L');
$this->MultiCell(0,0,'Tcpdf Action: '.$this->action,0,'L');
$this->MultiCell(0,0,'Bean ID: '.$this->bean->getFieldValue('id'),0,'L');
$this->SetFont(PDF_FONT_NAME_MAIN,'',12);
$this->MultiCell(0,0,'---',0,'L');
}
/**
* [OVERRIDE] Cell method in tcpdf library.
* Handle charset conversion and HTML entity decode.
* This method override the regular Cell() method to apply the prepare_string() function to
* the string to print in the PDF.
* The cell method is used by all the methods which print text (Write, MultiCell).
* @see include/tcpdf/TCPDF#Cell()
*/
public function Cell($w, $h=0, $txt='', $border=0, $ln=0, $align='', $fill=0, $link='', $stretch=0) {
parent::Cell($w, $h, prepare_string($txt), $border, $ln, $align, $fill, $link, $stretch);
}
/**
* This Ln1() method will always print a line break of one line height.
* The regular Ln() method print a line break which has the height of the last printed cell.
*/
public function Ln1() {
parent::Ln($this->FontSize * $this->cell_height_ratio + 2 * $this->cMargin, false);
}
/**
* This method allow printing a table using the MultiCell method with a formatted options array in parameter
* Options :
* header options override the regular options for the header's cells - $options['header']
* cell options override the regular options for the specific cell - Array[line number (0 to x)][cell header]['options']
* @param $item Array[line number (0 to x)][cell header] = Cell content OR
* Array[line number (0 to x)][cell header]['value'] = Cell content AND
* Array[line number (0 to x)][cell header]['options'] = Array[cell properties] = values
* @param $options Array which can contain : width (array 'column name'=>'width value + % OR nothing'), isheader (bool), header (array), fill (string: HTML color), ishtml (bool) default: false, border (0: no border (defaul), 1: frame or all of the following characters: L ,T ,R ,B), align (L: left align, C: center, R: right align, J: justification)
* @see MultiCell()
*/
public function writeCellTable($item, $options=NULL){
// Save initial font values
$fontFamily = $this->getFontFamily();
$fontSize = $this->getFontSizePt();
$fontStyle = $this->getFontStyle();
$this->SetTextColor(0, 0, 0);
$options = $this->initOptionsForWriteCellTable($options, $item);
// HEADER
if(!isset($options['isheader']) || $options['isheader'] == true){
$headerOptions = $options;
if(!empty($options['header']) && is_array($options['header'])){
$headerOptions = $this->initOptionsForWriteCellTable($options['header'], $item);
}
foreach($item[0] as $k => $v){
$header[$k]=$k;
}
$h = $this->getLineHeightFromArray($header, $options["width"]);
foreach($header as $v){
$this->MultiCell($options["width"][$v],$h,$v,$headerOptions['border'],$headerOptions['align'],$headerOptions['fillstate'],0,'','',true,0,$headerOptions['ishtml']);
}
$this->SetFillColorArray($this->convertHTMLColorToDec($options['fill']));
$this->Ln();
}
// MAIN
// default font
$this->SetFont($fontFamily,$fontStyle,$fontSize);
$this->SetTextColor(0, 0, 0);
$even=true;
// LINES
foreach($item as $k=>$line){
$even=!$even;
$h = $this->getLineHeightFromArray($line, $options["width"]);
//CELLS
foreach($line as $kk=>$cell){
$cellOptions = $options;
$value = $cell;
if(is_array($cell)){
$value = $cell['value'];
if(!empty($cell['options']) && is_array($cell['options'])){
$cellOptions = $this->initOptionsForWriteCellTable($cell['options'], $item);
}
}
if($even && !empty($options['evencolor'])){
$this->SetFillColorArray($this->convertHTMLColorToDec($options['evencolor']));
$cellOptions['fillstate']=1;
}else if(!$even && !empty($options['oddcolor'])){
$this->SetFillColorArray($this->convertHTMLColorToDec($options['oddcolor']));
$cellOptions['fillstate']=1;
}
$this->MultiCell($options["width"][$kk],$h,$value,$cellOptions['border'],$cellOptions['align'],$cellOptions['fillstate'],0,'','',true,0,$cellOptions['ishtml']);
$this->SetFillColorArray($this->convertHTMLColorToDec($options['fill']));
}
$this->Ln();
}
$this->SetFont($fontFamily,$fontStyle,$fontSize);
$this->SetTextColor(0, 0, 0);
}
/**
* This method allow printing a table using the writeHTML method with a formatted array in parameter
* This method can also return the table as HTML code
* @param $item Array[line number (0 to x)][cell header] = Cell content OR
* Array[line number (0 to x)][cell header]['value'] = Cell content AND
* Array[line number (0 to x)][cell header]['options'] = Array[cell properties] = values
* @param $returnHtml (bool) Return the table as HTML code instead of printing the HTML table
* @param $options Array which can contain : table (array of "HTML proprty"=>"value"),td (array of "HTML proprty"=>"value"), tr (array of "HTML proprty"=>"value"), isheader(bool), header (array of "HTML proprty"=>"value"), width (array 'column name'=>'width value + unit OR nothing')
* @return the HTML code if $returnHtml set to true
*/
public function writeHTMLTable($item, $returnHtml=false, $options=NULL){
//TODO ISSUE - width in % for the td have to be multiply by the number of column.
// ex: for a width of 20% in a table of 6 columns the width will have to be 120% (20*6).
$html="";
$line="";
if(!empty($options)){
foreach($options as $k=>$v){
$tmp[strtolower($k)]=$v;
}
$options=$tmp;
}else{
$options=array();
}
if(!isset($options["isheader"]) || $options["isheader"] == true){
if(!empty($options["header"])){
foreach($options["header"] as $k=>$v){
$tmp[strtolower($k)]=$v;
}
$options["header"]=$tmp;
}else{
$options["header"]=array("tr"=>array("bgcolor"=>"#DCDCDC"),"td"=>array());
}
foreach($item[0] as $k => $v){
if(!empty($options["width"]))$options["header"]["td"]["width"]=$options["width"][$k];
$line.=$this->wrap("td", $k, $options["header"]);
}
$html.=$this->wrap("tr", $line, $options["header"]);
}
foreach ($item as $k=>$v){
$line="";
foreach($v as $kk => $vv){
if(!empty($options["width"]) && isset($options["width"][$kk]))$options["td"]["width"]=$options["width"][$kk];
$line.=$this->wrap("td", $vv, $options);
}
$html.=$this->wrap("tr", $line, $options);
}
$html=$this->wrap("table", $html, $options);
if($returnHtml){
return $html;
}else{
$this->writeHTML($html);
}
}
/**
* return the HTML code of the value wrap with the tag $tag. This method handle options (general and specific)
* @param $tag
* @param $value
* @param $options
* @return the HTML wrapped code
*/
private function wrap($tag, $value, $options){
if(empty($options[$tag])){
$options[$tag] = array();
}
if(is_array($value)){
if(isset($value["options"])){
// The options of a specific entity overwrite the general options
$options[$tag] = $value["options"];
}
if(isset($value["value"])){
$value = $value["value"];
}else{
$value = "";
}
}
return wrapTag($tag, $value, $options[$tag]);
}
/**
* Return the heigth of a line depending of the width, the font and the content
* @param $line Array containing the data of all the cells of the line
* @param $width Array containing the width of all the cells of the line
* @return The heigth of the line
*/
private function getLineHeightFromArray($line, $width){
$h=0;
foreach($line as $kk=>$cell){
$cellValue = $cell;
if(is_array($cellValue)){
$tmp = $cellValue['value'];
$cellValue = $tmp;
}
if($h<$this->getNumLines($cellValue, $width[$kk])){
$h=$this->getNumLines($cellValue, $width[$kk]);
}
}
return $h * $this->FontSize * $this->cell_height_ratio + 2 * $this->cMargin;
}
/**
* Private method for writeCellTable which format and initialize the options array.
* @param $options array
* @param $item array
* @return $options array
*/
private function initOptionsForWriteCellTable($options, $item){
if(!empty($options)){
foreach($options as $k=>$v){
$tmp[strtolower($k)]=$v;
}
$options=$tmp;
}else{
$options=array();
}
// set to default if empty
if(empty($options["width"]) || !is_array($options["width"])){
$colNum = count($item[0]);
$defaultWidth = $this->getRemainingWidth()/$colNum;
foreach($item[0] as $k => $v){
$options["width"][$k]=$defaultWidth;
}
}else{
foreach($options["width"] as $k => $v){
$options["width"][$k] = $this->getHTMLUnitToUnits($v, $this->getRemainingWidth());
}
}
if(empty($options["border"])){
$options["border"]=0;
}
if(empty($options["align"])){
$options["align"]="L";
}
if(empty($options['ishtml'])){
$options['ishtml'] = false;
}
if(empty($options['border'])){
$options['border'] = 0;
}
if(!empty($options['fill'])){
$this->SetFillColorArray($this->convertHTMLColorToDec($options['fill']));
$options['fillstate']=1;
}else{
$options['fill']="#FFFFFF";//white
$options['fillstate']=0;
}
if(!empty($options['fontfamily'])){
$fontFamily = $options['fontfamily'];
}else{
$fontFamily = $this->getFontFamily();
}
if(!empty($options['fontsize'])){
$fontSize = $options['fontsize'];
}else{
$fontSize = $this->getFontSizePt();
}
if(!empty($options['fontstyle'])){
$fontStyle = $options['fontstyle'];
}else{
$fontStyle = $this->getFontStyle();
}
if(!empty($options['textcolor'])){
$this->SetTextColorArray($this->convertHTMLColorToDec($options['textcolor']));
}else{
$this->SetTextColor(0, 0, 0);//black
}
$this->SetFont($fontFamily, $fontStyle, $fontSize);
return $options;
}
/**
* This is method is fix for a better handling of the count. This method now handle the line break
* between words.
* This method returns the estimated number of lines required to print the text.
* @param string $txt text to print
* @param float $w width of cell. If 0, they extend up to the right margin of the page.
* @return int Return the estimated number of lines.
* @access public
* @since 4.5.011
* @OVERRIDE
*/
public function getNumLines($txt, $w=0) {
$lines = 0;
if (empty($w) OR ($w <= 0)) {
if ($this->rtl) {
$w = $this->x - $this->lMargin;
} else {
$w = $this->w - $this->rMargin - $this->x;
}
}
// max column width
$wmax = $w - (2 * $this->cMargin);
// remove carriage returns
$txt = str_replace("\r", '', $txt);
// divide text in blocks
$txtblocks = explode("\n", $txt);
// for each block;
foreach ($txtblocks as $block) {
// estimate the number of lines
if(empty($block)){
$lines++;
// If the block is in more than one line
}else if(ceil($this->GetStringWidth($block) / $wmax)>1){
//devide in words
$words = explode(" ", $block);
//TODO explode with space is not the best things to do...
$wordBlock = "";
$first=true;
$lastNum = 0;
$run = false;
for($i=0; $i<count($words); $i++){
if($first){
$wordBlock = $words[$i];
}else{
$wordBlock .= " ".$words[$i];
}
if(ceil($this->GetStringWidth($wordBlock) / $wmax)>1){
if($first){
$lastNum = ceil($this->GetStringWidth($wordBlock) / $wmax);
$run = true;
$first = false;
}else{
if($run && $lastNum == ceil($this->GetStringWidth($wordBlock) / $wmax)){
// save the number of line if it is the last loop
if($i+1 == count($words)){
$lines += ceil($this->GetStringWidth($wordBlock) / $wmax);
}
continue;
}else{
$first = true;
$lines += ceil($this->GetStringWidth( substr($wordBlock, 0, (strlen($wordBlock) - strlen(" ".$words[$i]))) ) / $wmax);
$i--;
$lastNum = 0;
$run = false;
}
}
}else{
$first = false;
}
// save the number of line if it is the last loop
if($i+1 == count($words)){
$lines += ceil($this->GetStringWidth($wordBlock) / $wmax);
}
}
}else{
$lines++;
}
}
return $lines;
}
/**
* Disable zlib output compression if we are downloading the PDF.
*
* @see TCPDF::Output()
*/
public function Output($name='doc.pdf', $dest='I')
{
if ( $dest == 'I' || $dest == 'D') {
ini_set('zlib.output_compression', 'Off');
}
return parent::Output($name,$dest);
}
}

View File

@@ -0,0 +1,145 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
require_once('include/Sugarpdf/Sugarpdf.php');
class SugarpdfFactory{
/**
* load the correct Tcpdf
* @param string $type Tcpdf Type
* @return valid Tcpdf
*/
function loadSugarpdf($type = 'default', $module, $bean = null, $sugarpdf_object_map = array()){
$type = strtolower($type);
//SugarpdfFactory::_loadConfig($sugarpdf, $type);
//first let's check if the module handles this Tcpdf
$sugarpdf = null;
$path = '/sugarpdf/sugarpdf.'.$type.'.php';
if(file_exists('custom/modules/'.$module.$path)){
$sugarpdf = SugarpdfFactory::_buildFromFile('custom/modules/'.$module.$path, $bean, $sugarpdf_object_map, $type, $module);
}else if(file_exists('modules/'.$module.$path)){
$sugarpdf = SugarpdfFactory::_buildFromFile('modules/'.$module.$path, $bean, $sugarpdf_object_map, $type, $module);
}else if(file_exists('custom/include/Sugarpdf'.$path)){
$sugarpdf = SugarpdfFactory::_buildFromFile('custom/include/Sugarpdf'.$path, $bean, $sugarpdf_object_map, $type, $module);
}else{
//if the module does not handle this Sugarpdf, then check if Sugar handles it OOTB
$file = 'include/Sugarpdf'.$path;
if(file_exists($file)){
//it appears Sugar does have the proper logic for this file.
$sugarpdf = SugarpdfFactory::_buildFromFile($file, $bean, $sugarpdf_object_map, $type, $module);
}
}
// Default to Sugarpdf if still nothing found/built
if (!isset($sugarpdf))
$sugarpdf = new Sugarpdf($bean, $sugarpdf_object_map);
return $sugarpdf;
}
/**
* Load the Sugarpdf_<Sugarpdf>_config.php file which holds options used by the tcpdf.
*/
// function _loadConfig(&$sugarpdf, $type){
//// $sugarpdf_config_custom = array();
//// $sugarpdf_config_module = array();
//// $sugarpdf_config_root_cstm = array();
//// $sugarpdf_config_root = array();
//// $sugarpdf_config_app = array();
// $config_file_name = 'sugarpdf.'.$type.'.config.php';
// //echo ' <br /> '.$config_file_name.' <br />';
// //$sugarpdf_config = sugar_cache_retrieve("SUGARPDF_CONFIG_FILE_".$sugarpdf->module."_TYPE_".$type);
// if(!$sugarpdf_config){
// if(file_exists('custom/modules/'.$sugarpdf->module.'/sugarpdf/'.$config_file_name)){
// require_once('custom/modules/'.$sugarpdf->module.'/sugarpdf/'.$config_file_name);
// }
// if(file_exists('modules/'.$sugarpdf->module.'/sugarpdf/'.$config_file_name)){
// require_once('modules/'.$sugarpdf->module.'/sugarpdf/'.$config_file_name);
// }
// if(file_exists('custom/include/Sugarpdf/sugarpdf/'.$config_file_name)){
// require_once('custom/include/Sugarpdf/sugarpdf/'.$config_file_name);
// }
// if(file_exists('include/Sugarpdf/sugarpdf/'.$config_file_name)){
// require_once('include/Sugarpdf/sugarpdf/'.$config_file_name);
// }
// if(file_exists('include/Sugarpdf/sugarpdf/sugarpdf.config.php')){
// require_once('include/Sugarpdf/sugarpdf/sugarpdf.config.php');
// }
// }
//
// }
/**
* This is a private function which just helps the getSugarpdf function generate the
* proper Tcpdf object
*
* @return a valid Sugarpdf
*/
function _buildFromFile($file, &$bean, $sugarpdf_object_map, $type, $module){
require_once($file);
//try ModuleSugarpdfType first then try SugarpdfType if that fails then use Sugarpdf
$class = ucfirst($module).'Sugarpdf'.ucfirst($type);
if(!class_exists($class)){
$class = 'Sugarpdf'.ucfirst($type);
if(!class_exists($class)){
return new Sugarpdf($bean, $sugarpdf_object_map);
}
}
return SugarpdfFactory::_buildClass($class, $bean, $sugarpdf_object_map);
}
/**
* instantiate the correct Tcpdf and call init to pass on any obejcts we need to
* from the controller.
*
* @param string class - the name of the class to instantiate
* @param object bean = the bean to pass to the Sugarpdf
* @param array Sugarpdf_object_map - the array which holds obejcts to pass between the
* controller and the tcpdf.
*
* @return Sugarpdf
*/
function _buildClass($class, &$bean, $sugarpdf_object_map){
$sugarpdf = new $class($bean, $sugarpdf_object_map);
//$sugarpdf->init($bean, $sugarpdf_object_map);
if($sugarpdf instanceof Sugarpdf){
return $sugarpdf;
}else
return new Sugarpdf($bean, $sugarpdf_object_map);
}
}
?>

View File

@@ -0,0 +1,192 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
function wrapTD($html, $options){
return wrapTag("td",$html, $options);
}
function wrapTR($html, $options){
return wrapTag("tr",$html, $options);
}
function wrapTable($html, $options){
return wrapTag("table",$html, $options);
}
function wrapB($html){
return "<b>".$html."</b>";
}
function wrapI($html){
return "<i>".$html."</i>";
}
function wrapTag($tag, $html, $options){
// Wrap the tags defined in the options array (like b, i, font... tags)
if(!empty($options)){
foreach($options as $k=>$v){
if(is_array($v)){
$html = wrapTag($k, "$html", $v);
}
}
}
// wrap the HTML content with the passed tag
$return = "<$tag ";
if(!empty($options)){
foreach($options as $k=>$v){
if(!is_array($v)){
$return .= " $k=".'"'.$v.'"';
}
}
}
return $return.">".$html."</$tag>";
}
/**
* This function prepare a string to be ready for the PDF printing.
* @param $string
* @return string
*/
function prepare_string($string){
global $locale;
$string = html_entity_decode($string, ENT_QUOTES);
// return $locale->translateCharset($string, 'UTF-8', $locale->getExportCharset());
return $string;
}
/**
* Copy of format_number() from currency with fix for sugarpdf.
* @return String formatted currency value
* @see modules/Currencies/Currency.php
*/
function format_number_sugarpdf($amount, $round = null, $decimals = null, $params = array()) {
global $app_strings, $current_user, $sugar_config, $locale;
static $current_users_currency = null;
static $last_override_currency = null;
static $override_currency_id = null;
static $currency;
$seps = get_number_seperators();
$num_grp_sep = $seps[0];
$dec_sep = $seps[1];
// cn: bug 8522 - sig digits not honored in pdfs
if(is_null($decimals)) {
$decimals = $locale->getPrecision();
}
if(is_null($round)) {
$round = $locale->getPrecision();
}
// only create a currency object if we need it
if((!empty($params['currency_symbol']) && $params['currency_symbol']) ||
(!empty($params['convert']) && $params['convert']) ||
(!empty($params['currency_id']))) {
// if we have an override currency_id
if(!empty($params['currency_id'])) {
if($override_currency_id != $params['currency_id']) {
$override_currency_id = $params['currency_id'];
$currency = new Currency();
$currency->retrieve($override_currency_id);
$last_override_currency = $currency;
} else {
$currency = $last_override_currency;
}
} elseif(!isset($current_users_currency)) { // else use current user's
$current_users_currency = new Currency();
if($current_user->getPreference('currency')) $current_users_currency->retrieve($current_user->getPreference('currency'));
else $current_users_currency->retrieve('-99'); // use default if none set
$currency = $current_users_currency;
}
}
if(!empty($params['convert']) && $params['convert']) {
$amount = $currency->convertFromDollar($amount, 6);
}
if(!empty($params['currency_symbol']) && $params['currency_symbol']) {
if(!empty($params['symbol_override'])) {
$symbol = $params['symbol_override'];
}
// BEGIN SUGARPDF
/*elseif(!empty($params['type']) && $params['type'] == 'pdf') {
$symbol = $currency->getPdfCurrencySymbol();
$symbol_space = false;
}*/
elseif(!empty($params['type']) && $params['type'] == 'sugarpdf') {
$symbol = $currency->symbol;
$symbol_space = false;
}
// END SUGARPDF
else {
if(empty($currency->symbol))
$symbol = $currency->getDefaultCurrencySymbol();
else
$symbol = $currency->symbol;
$symbol_space = true;
}
} else {
$symbol = '';
}
if(isset($params['charset_convert'])) {
$symbol = $locale->translateCharset($symbol, 'UTF-8', $locale->getExportCharset());
}
if(empty($params['human'])) {
$amount = number_format(round($amount, $round), $decimals, $dec_sep, $num_grp_sep);
$amount = format_place_symbol($amount, $symbol,(empty($params['symbol_space']) ? false : true));
} else {
// If amount is more greater than a thousand(postiive or negative)
if(strpos($amount, '.') > 0) {
$checkAmount = strlen(substr($amount, 0, strpos($amount, '.')));
}
if($checkAmount >= 1000 || $checkAmount <= -1000) {
$amount = round(($amount / 1000), 0);
$amount = $amount . 'k';
$amount = format_place_symbol($amount, $symbol,(empty($params['symbol_space']) ? false : true));
} else {
$amount = format_place_symbol($amount, $symbol,(empty($params['symbol_space']) ? false : true));
}
}
if(!empty($params['percentage']) && $params['percentage']) $amount .= $app_strings['LBL_PERCENTAGE_SYMBOL'];
return $amount;
} //end function format_number
?>

View File

@@ -0,0 +1,107 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
require_once('include/Sugarpdf/Sugarpdf.php');
/**
* This is an helper class to generate PDF using smarty template.
* You have to extend this class, set the templateLocation to your smarty template
* location and assign the Smarty variables ($this->ss->assign()) in the overriden
* preDisplay method (don't forget to call the parent).
*
* @author bsoufflet
*
*/
class SugarpdfSmarty extends Sugarpdf{
/**
*
* @var String
*/
protected $templateLocation = "";
/**
* The Sugar_Smarty object
* @var Sugar_Smarty
*/
protected $ss;
/**
* These 5 variables are use for the writeHTML method.
* @see include/tcpdf/tcpdf.php writeHTML()
*/
protected $smartyLn = true;
protected $smartyFill = false;
protected $smartyReseth = false;
protected $smartyCell = false;
protected $smartyAlign = "";
function preDisplay(){
parent::preDisplay();
$this->print_header = false;
$this->print_footer = false;
$this->_initSmartyInstance();
}
function display(){
//turn off all error reporting so that PHP warnings don't munge the PDF code
error_reporting(E_ALL);
set_time_limit(1800);
//Create new page
$this->AddPage();
$this->SetFont(PDF_FONT_NAME_MAIN,'',8);
if(!empty($this->templateLocation)){
$str = $this->ss->fetch($this->templateLocation);
$this->writeHTML($str, $this->smartyLn, $this->smartyFill, $this->smartyReseth, $this->smartyCell, $this->smartyAlign);
}else{
$this->Error('The class SugarpdfSmarty has to be extended and you have to set a location for the Smarty template.');
}
}
/**
* Init the Sugar_Smarty object.
*/
private function _initSmartyInstance(){
if ( !($this->ss instanceof Sugar_Smarty) ) {
require_once('include/Sugar_Smarty.php');
$this->ss = new Sugar_Smarty();
$this->ss->assign('MOD', $GLOBALS['mod_strings']);
$this->ss->assign('APP', $GLOBALS['app_strings']);
}
}
}

View File

@@ -0,0 +1,339 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
require_once('include/Sugarpdf/sugarpdf_default.php');
if(file_exists('custom/include/Sugarpdf/sugarpdf_default.php')){
require_once('custom/include/Sugarpdf/sugarpdf_default.php');
}
// set alternative config file
if (!defined('K_TCPDF_EXTERNAL_CONFIG')) {
/*
* Installation path of TCPDF
*/
define ("K_PATH_MAIN", $sugarpdf_default["K_PATH_MAIN"]);
/**
* URL path to tcpdf installation folder
*/
define ("K_PATH_URL", $sugarpdf_default["K_PATH_URL"]);
/**
* custom path for PDF fonts (Use for non core added fonts)
*/
define ("K_PATH_CUSTOM_FONTS", $sugarpdf_default["K_PATH_CUSTOM_FONTS"]);
/**
* path for PDF fonts
*/
define ("K_PATH_FONTS", $sugarpdf_default["K_PATH_FONTS"]);
/**
* cache directory for temporary files (full path)
*/
define ("K_PATH_CACHE", $sugarpdf_default["K_PATH_CACHE"]);
/**
* cache directory for temporary files (url path)
*/
define ("K_PATH_URL_CACHE", $sugarpdf_default["K_PATH_URL_CACHE"]);
/*
* Custom path for images (use for loaded logos)
*/
define ("K_PATH_CUSTOM_IMAGES", $sugarpdf_default["K_PATH_CUSTOM_IMAGES"]);
/*
* Default path for images
*/
define ("K_PATH_IMAGES", $sugarpdf_default["K_PATH_IMAGES"]);
/*
* Blank image
*/
define ("K_BLANK_IMAGE", $sugarpdf_default["K_BLANK_IMAGE"]);
/*
* The format used for pages.
* It can be either one of the following values (case insensitive)
* or a custom format in the form of a two-element array containing
* the width and the height (expressed in the unit given by unit).
* 4A0, 2A0, A0, A1, A2, A3, A4 (default), A5, A6, A7, A8, A9, A10,
* B0, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10, C0, C1, C2, C3, C4,
* C5, C6, C7, C8, C9, C10, RA0, RA1, RA2, RA3, RA4, SRA0, SRA1,
* SRA2, SRA3, SRA4, LETTER, LEGAL, EXECUTIVE, FOLIO.
*/
defineFromUserPreference ("PDF_PAGE_FORMAT", $sugarpdf_default["PDF_PAGE_FORMAT"]);
define("PDF_PAGE_FORMAT_LIST", $sugarpdf_default["PDF_PAGE_FORMAT_LIST"]);
/*
* page orientation. Possible values are (case insensitive):P or Portrait (default), L or Landscape.
*/
defineFromUserPreference ("PDF_PAGE_ORIENTATION", $sugarpdf_default["PDF_PAGE_ORIENTATION"]);
define("PDF_PAGE_ORIENTATION_LIST", $sugarpdf_default["PDF_PAGE_ORIENTATION_LIST"]);
/*
* Defines the creator of the document. This is typically the name of the application that generates the PDF.
*/
defineFromConfig("PDF_CREATOR", $sugarpdf_default["PDF_CREATOR"]);
/*
* Defines the author of the document.
*/
defineFromConfig("PDF_AUTHOR", $sugarpdf_default["PDF_AUTHOR"]);
/**
* header title
*/
defineFromConfig("PDF_HEADER_TITLE", $sugarpdf_default["PDF_HEADER_TITLE"]);
/**
* header description string
*/
defineFromConfig("PDF_HEADER_STRING", $sugarpdf_default["PDF_HEADER_STRING"]);
/**
* image logo for the default Header
*/
defineFromConfig("PDF_HEADER_LOGO", $sugarpdf_default["PDF_HEADER_LOGO"]);
/**
* header logo image width [mm]
*/
defineFromConfig("PDF_HEADER_LOGO_WIDTH", $sugarpdf_default["PDF_HEADER_LOGO_WIDTH"]);
/**
* image logo for the default Header
*/
defineFromConfig("PDF_SMALL_HEADER_LOGO", $sugarpdf_default["PDF_SMALL_HEADER_LOGO"]);
/**
* header logo image width [mm]
*/
defineFromConfig("PDF_SMALL_HEADER_LOGO_WIDTH", $sugarpdf_default["PDF_SMALL_HEADER_LOGO_WIDTH"]);
/**
* document unit of measure [pt=point, mm=millimeter, cm=centimeter, in=inch]
*/
defineFromConfig('PDF_UNIT', $sugarpdf_default["PDF_UNIT"]);
/**
* header margin
*/
defineFromUserPreference ('PDF_MARGIN_HEADER', $sugarpdf_default["PDF_MARGIN_HEADER"]);
/**
* footer margin
*/
defineFromUserPreference ('PDF_MARGIN_FOOTER', $sugarpdf_default["PDF_MARGIN_FOOTER"]);
/**
* top margin
*/
defineFromUserPreference ('PDF_MARGIN_TOP', $sugarpdf_default["PDF_MARGIN_TOP"]);
/**
* bottom margin
*/
defineFromUserPreference ('PDF_MARGIN_BOTTOM', $sugarpdf_default["PDF_MARGIN_BOTTOM"]);
/**
* left margin
*/
defineFromUserPreference ('PDF_MARGIN_LEFT', $sugarpdf_default["PDF_MARGIN_LEFT"]);
/**
* right margin
*/
defineFromUserPreference ('PDF_MARGIN_RIGHT', $sugarpdf_default["PDF_MARGIN_RIGHT"]);
/**
* main font name
*/
defineFromUserPreference ('PDF_FONT_NAME_MAIN', $sugarpdf_default["PDF_FONT_NAME_MAIN"]);
/**
* main font size
*/
defineFromUserPreference ("PDF_FONT_SIZE_MAIN", $sugarpdf_default["PDF_FONT_SIZE_MAIN"]);
/**
* data font name
*/
defineFromUserPreference ('PDF_FONT_NAME_DATA', $sugarpdf_default["PDF_FONT_NAME_DATA"]);
/**
* data font size
*/
defineFromUserPreference ('PDF_FONT_SIZE_DATA', $sugarpdf_default["PDF_FONT_SIZE_DATA"]);
/**
* Ratio used to scale the images
*/
defineFromConfig('PDF_IMAGE_SCALE_RATIO', $sugarpdf_default["PDF_IMAGE_SCALE_RATIO"]);
/**
* magnification factor for titles
*/
defineFromConfig('HEAD_MAGNIFICATION', $sugarpdf_default["HEAD_MAGNIFICATION"]);
/**
* height of cell repect font height
*/
defineFromConfig('K_CELL_HEIGHT_RATIO', $sugarpdf_default["K_CELL_HEIGHT_RATIO"]);
/**
* title magnification respect main font size
*/
defineFromConfig('K_TITLE_MAGNIFICATION', $sugarpdf_default["K_TITLE_MAGNIFICATION"]);
/**
* reduction factor for small font
*/
defineFromConfig('K_SMALL_RATIO', $sugarpdf_default["K_SMALL_RATIO"]);
}
// Sugarpdf define
/**
* PDF class use to generate pdf : EZPDF or TCPDF
*/
defineFromConfig("PDF_CLASS", $sugarpdf_default["PDF_CLASS"]);
/**
* Enable or not the EZPDF class (enable for upgraded system disable otherwise) : 1 or 0
*/
defineFromConfig("PDF_ENABLE_EZPDF", $sugarpdf_default["PDF_ENABLE_EZPDF"]);
/**
* Default file name for the generated pdf file.
*/
defineFromConfig("PDF_FILENAME", $sugarpdf_default["PDF_FILENAME"]);
/**
* Title of the document
*/
defineFromConfig("PDF_TITLE", $sugarpdf_default["PDF_TITLE"]);
/**
* Keywords of the PDF document
*/
defineFromConfig("PDF_KEYWORDS", $sugarpdf_default["PDF_KEYWORDS"]);
/**
* Subject of the PDF document
*/
defineFromConfig("PDF_SUBJECT", $sugarpdf_default["PDF_SUBJECT"]);
/**
* Compression of the PDF Document
*/
defineFromConfig("PDF_COMPRESSION", $sugarpdf_default["PDF_COMPRESSION"]);
/**
* Quality of the JPEG images (0 to 100)
*/
defineFromConfig("PDF_JPEG_QUALITY", $sugarpdf_default["PDF_JPEG_QUALITY"]);
/**
* PDF version of the PDF document
*/
defineFromConfig("PDF_PDF_VERSION", $sugarpdf_default["PDF_PDF_VERSION"]);
/**
* Set document protection (available are: copy, print, modify, annot-forms. Seperate with a coma)
*/
defineFromConfig("PDF_PROTECTION", $sugarpdf_default["PDF_PROTECTION"]);
/**
* User password to view the document. If empty no password
*/
defineFromConfig("PDF_USER_PASSWORD", $sugarpdf_default["PDF_USER_PASSWORD"]);
/**
* master password to get full access.
*/
defineFromConfig("PDF_OWNER_PASSWORD", $sugarpdf_default["PDF_OWNER_PASSWORD"]);
/**
* Default ACL access value for the generation of a PDF (detail, list, edit, export)
*/
defineFromConfig("PDF_ACL_ACCESS", $sugarpdf_default["PDF_ACL_ACCESS"]);
/**
* Available encoding tables when adding a new font
*/
define("PDF_ENCODING_TABLE_LIST", $sugarpdf_default["PDF_ENCODING_TABLE_LIST"]);
/**
* Available encoding tables when adding a new font (Label)
*/
define("PDF_ENCODING_TABLE_LABEL_LIST", $sugarpdf_default["PDF_ENCODING_TABLE_LABEL_LIST"]);
define("K_TCPDF_EXTERNAL_CONFIG", true);
/**
* Function to define a sugarpdf seeting from the admin application settings (config table).
* This function use the default value if there is nothing in the table.
* @param $value settings to search
* @param $default default value
*/
function defineFromConfig($value, $default){
$lowerValue = strtolower($value);
require_once("modules/Administration/Administration.php");
$focus = new Administration();
$focus->retrieveSettings();
if(isset($focus->settings["sugarpdf_".$lowerValue])){
define($value, $focus->settings["sugarpdf_".$lowerValue]);
}else{
define($value, $default);
}
}
/**
* This function define a Sugarpdf setting from the user preferences.
* This function use the default value if there is no preference.
* If SUGARPDF_USE_DEFAULT_SETTINGS is define the function will always
* use the default value.
* SUGARPDF_USE_FOCUS is use to load the preference of the none current user. To use
* this constant you have to define a global variable $focus_user.
*
* @param $value settings to search
* @param $default default value
*/
function defineFromUserPreference($value, $default){
global $focus_user, $current_user;
$lowerValue = strtolower($value);
if(defined('SUGARPDF_USE_FOCUS')){
$pref = $focus_user->getPreference("sugarpdf_".$lowerValue);
}else{
$pref = $current_user->getPreference("sugarpdf_".$lowerValue);
}
if(strpos($value, "PDF_FONT_NAME_") !== false){
require_once('include/Sugarpdf/FontManager.php');
$fontManager = new FontManager();
$fontManager->listFontFiles();
if(!isset($fontManager->fontList[$pref]) || !$fontManager->fontFileExist($fontManager->fontList[$pref]['filename'])){
$pref = $default;
}
}
if(isset($pref) && !defined('SUGARPDF_USE_DEFAULT_SETTINGS')){
define($value, $pref);
}else{
define($value, $default);
}
}

View File

@@ -0,0 +1,109 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/**
* This array define the default value to use for the sugarpdf settings.
* The order is DB (user or system) -> custom sugarpdf_default -> OOB sugarpdf_default
*/
$sugarpdf_default = array(
"K_PATH_MAIN"=>"include/tcpdf/",
"K_PATH_URL"=>"include/tcpdf/",
"K_PATH_FONTS"=>"include/tcpdf/fonts/",
"K_PATH_CUSTOM_FONTS"=>"custom/include/tcpdf/fonts/",
"K_PATH_CACHE"=>"include/tcpdf/cache/",
"K_PATH_URL_CACHE"=>"include/tcpdf/cache/",
"K_PATH_CUSTOM_IMAGES"=>"custom/themes/default/images/",
"K_PATH_IMAGES"=>"themes/default/images/",
"K_BLANK_IMAGE"=>"themes/default/images/_blank.png",
"PDF_PAGE_FORMAT"=>"A4",
"PDF_PAGE_FORMAT_LIST"=>implode(",",array("4A0", "2A0", "A0", "A1", "A2", "A3", "A4", "A5", "A6", "A7", "A8", "A9", "A10",
"B0", "B1", "B2", "B3", "B4", "B5", "B6", "B7", "B8", "B9", "B10",
"C0", "C1", "C2", "C3", "C4", "C5", "C6", "C7", "C8", "C9", "C10",
"RA0", "RA1", "RA2", "RA3", "RA4", "SRA0", "SRA1", "SRA2", "SRA3", "SRA4",
"LETTER", "LEGAL", "EXECUTIVE", "FOLIO")),
"PDF_PAGE_ORIENTATION"=>"P",
"PDF_PAGE_ORIENTATION_LIST"=>implode(",",array("P"=>"P", "L"=>"L")),
"PDF_CREATOR"=>"SugarCRM",
"PDF_AUTHOR"=>"SugarCRM",
"PDF_HEADER_TITLE"=>"SugarCRM",
"PDF_HEADER_STRING"=>"TCPDF for SugarCRM",
"PDF_HEADER_LOGO"=>"pdf_logo.jpg",
"PDF_HEADER_LOGO_WIDTH"=>120,
"PDF_SMALL_HEADER_LOGO"=>"pdf_logo_small.jpg",
"PDF_SMALL_HEADER_LOGO_WIDTH"=>60,
'PDF_UNIT'=>'mm',
'PDF_MARGIN_HEADER'=>5,
'PDF_MARGIN_FOOTER'=>10,
'PDF_MARGIN_TOP'=>27,
'PDF_MARGIN_BOTTOM'=>25,
'PDF_MARGIN_LEFT'=>15,
'PDF_MARGIN_RIGHT'=>15,
'PDF_FONT_NAME_MAIN'=>'helvetica',
"PDF_FONT_SIZE_MAIN"=>8,
'PDF_FONT_NAME_DATA'=>'helvetica',
'PDF_FONT_SIZE_DATA'=>8,
'PDF_IMAGE_SCALE_RATIO'=>3,
'HEAD_MAGNIFICATION'=>1.1,
'K_CELL_HEIGHT_RATIO'=>1.25,
'K_TITLE_MAGNIFICATION'=>1.3,
'K_SMALL_RATIO'=>2/3,
"PDF_CLASS"=>"TCPDF",
"PDF_ENABLE_EZPDF"=>"0",
"PDF_FILENAME"=>"output.pdf",
"PDF_TITLE"=>"SugarCRM",
"PDF_KEYWORDS"=>"SugarCRM",
"PDF_SUBJECT"=>"SugarCRM",
"PDF_COMPRESSION"=>"true",
"PDF_JPEG_QUALITY"=>"75",
"PDF_PDF_VERSION"=>"1.7",
"PDF_PROTECTION"=>implode(",",array("print","copy")),
"PDF_USER_PASSWORD"=>"",
"PDF_OWNER_PASSWORD"=>"",
"PDF_ACL_ACCESS"=>"detail",
"PDF_ENCODING_TABLE_LIST"=>implode(",",array("cp1250","cp1251","cp1252","cp1253","cp1254","cp1255","cp1257",
"cp1258","cp874","iso-8859-1","iso-8859-2","iso-8859-4","iso-8859-5",
"iso-8859-7","iso-8859-9","iso-8859-11","iso-8859-15","iso-8859-16",
"koi8-r","koi8-u")),
"PDF_ENCODING_TABLE_LABEL_LIST"=>implode(",",array("cp1250 (Central Europe)","cp1251 (Cyrillic)","cp1252 (Western Europe)",
"cp1253 (Greek)","cp1254 (Turkish)","cp1255 (Hebrew)","cp1257 (Baltic)",
"cp1258 (Vietnamese)","cp874 (Thai)","iso-8859-1 (Western Europe)",
"iso-8859-2 (Central Europe)","iso-8859-4 (Baltic)","iso-8859-5 (Cyrillic)",
"iso-8859-7 (Greek)","iso-8859-9 (Turkish)","iso-8859-11 (Thai)","iso-8859-15 (Western Europe)",
"iso-8859-16 (Central Europe)","koi8-r (Russian)","koi8-u (Ukrainian)")),
);
?>