From 824f8c45edb20e27221e92805b0090f1768a2756 Mon Sep 17 00:00:00 2001 From: tcit Date: Sat, 27 Sep 2014 19:34:17 +0200 Subject: changed mpdf with tcpdf --- inc/3rdparty/libraries/tcpdf/tcpdf_autoconfig.php | 242 ++++++++++++++++++++++ 1 file changed, 242 insertions(+) create mode 100644 inc/3rdparty/libraries/tcpdf/tcpdf_autoconfig.php (limited to 'inc/3rdparty/libraries/tcpdf/tcpdf_autoconfig.php') diff --git a/inc/3rdparty/libraries/tcpdf/tcpdf_autoconfig.php b/inc/3rdparty/libraries/tcpdf/tcpdf_autoconfig.php new file mode 100644 index 00000000..951c0b0f --- /dev/null +++ b/inc/3rdparty/libraries/tcpdf/tcpdf_autoconfig.php @@ -0,0 +1,242 @@ +. +// +// See LICENSE.TXT file for more information. +// ------------------------------------------------------------------- +// +// Description : Try to automatically configure some TCPDF +// constants if not defined. +// +//============================================================+ + +/** + * @file + * Try to automatically configure some TCPDF constants if not defined. + * @package com.tecnick.tcpdf + * @version 1.0.000 + */ + +// DOCUMENT_ROOT fix for IIS Webserver +if ((!isset($_SERVER['DOCUMENT_ROOT'])) OR (empty($_SERVER['DOCUMENT_ROOT']))) { + if(isset($_SERVER['SCRIPT_FILENAME'])) { + $_SERVER['DOCUMENT_ROOT'] = str_replace( '\\', '/', substr($_SERVER['SCRIPT_FILENAME'], 0, 0-strlen($_SERVER['PHP_SELF']))); + } elseif(isset($_SERVER['PATH_TRANSLATED'])) { + $_SERVER['DOCUMENT_ROOT'] = str_replace( '\\', '/', substr(str_replace('\\\\', '\\', $_SERVER['PATH_TRANSLATED']), 0, 0-strlen($_SERVER['PHP_SELF']))); + } else { + // define here your DOCUMENT_ROOT path if the previous fails (e.g. '/var/www') + $_SERVER['DOCUMENT_ROOT'] = '/'; + } +} +$_SERVER['DOCUMENT_ROOT'] = str_replace('//', '/', $_SERVER['DOCUMENT_ROOT']); +if (substr($_SERVER['DOCUMENT_ROOT'], -1) != '/') { + $_SERVER['DOCUMENT_ROOT'] .= '/'; +} + +// Load main configuration file only if the K_TCPDF_EXTERNAL_CONFIG constant is set to false. +if (!defined('K_TCPDF_EXTERNAL_CONFIG') OR !K_TCPDF_EXTERNAL_CONFIG) { + // define a list of default config files in order of priority + $tcpdf_config_files = array(dirname(__FILE__).'/config/tcpdf_config.php', '/etc/php-tcpdf/tcpdf_config.php', '/etc/tcpdf/tcpdf_config.php', '/etc/tcpdf_config.php'); + foreach ($tcpdf_config_files as $tcpdf_config) { + if (@file_exists($tcpdf_config) AND is_readable($tcpdf_config)) { + require_once($tcpdf_config); + break; + } + } +} + +if (!defined('K_PATH_MAIN')) { + define ('K_PATH_MAIN', dirname(__FILE__).'/'); +} + +if (!defined('K_PATH_FONTS')) { + define ('K_PATH_FONTS', K_PATH_MAIN.'fonts/'); +} + +if (!defined('K_PATH_URL')) { + $k_path_url = K_PATH_MAIN; // default value for console mode + if (isset($_SERVER['HTTP_HOST']) AND (!empty($_SERVER['HTTP_HOST']))) { + if(isset($_SERVER['HTTPS']) AND (!empty($_SERVER['HTTPS'])) AND (strtolower($_SERVER['HTTPS']) != 'off')) { + $k_path_url = 'https://'; + } else { + $k_path_url = 'http://'; + } + $k_path_url .= $_SERVER['HTTP_HOST']; + $k_path_url .= str_replace( '\\', '/', substr(K_PATH_MAIN, (strlen($_SERVER['DOCUMENT_ROOT']) - 1))); + } + define ('K_PATH_URL', $k_path_url); +} + +if (!defined('K_PATH_IMAGES')) { + $tcpdf_images_dirs = array(K_PATH_MAIN.'examples/images/', K_PATH_MAIN.'images/', '/usr/share/doc/php-tcpdf/examples/images/', '/usr/share/doc/tcpdf/examples/images/', '/usr/share/doc/php/tcpdf/examples/images/', '/var/www/tcpdf/images/', '/var/www/html/tcpdf/images/', '/usr/local/apache2/htdocs/tcpdf/images/', K_PATH_MAIN); + foreach ($tcpdf_images_dirs as $tcpdf_images_path) { + if (@file_exists($tcpdf_images_path)) { + break; + } + } + define ('K_PATH_IMAGES', $tcpdf_images_path); +} + +if (!defined('PDF_HEADER_LOGO')) { + $tcpdf_header_logo = ''; + if (@file_exists(K_PATH_IMAGES.'tcpdf_logo.jpg')) { + $tcpdf_header_logo = 'tcpdf_logo.jpg'; + } + define ('PDF_HEADER_LOGO', $tcpdf_header_logo); +} + +if (!defined('PDF_HEADER_LOGO_WIDTH')) { + if (!empty($tcpdf_header_logo)) { + define ('PDF_HEADER_LOGO_WIDTH', 30); + } else { + define ('PDF_HEADER_LOGO_WIDTH', 0); + } +} + +if (!defined('K_PATH_CACHE')) { + $K_PATH_CACHE = ini_get('upload_tmp_dir') ? ini_get('upload_tmp_dir') : sys_get_temp_dir(); + if (substr($K_PATH_CACHE, -1) != '/') { + $K_PATH_CACHE .= '/'; + } + define ('K_PATH_CACHE', $K_PATH_CACHE); +} + +if (!defined('K_BLANK_IMAGE')) { + define ('K_BLANK_IMAGE', '_blank.png'); +} + +if (!defined('PDF_PAGE_FORMAT')) { + define ('PDF_PAGE_FORMAT', 'A4'); +} + +if (!defined('PDF_PAGE_ORIENTATION')) { + define ('PDF_PAGE_ORIENTATION', 'P'); +} + +if (!defined('PDF_CREATOR')) { + define ('PDF_CREATOR', 'TCPDF'); +} + +if (!defined('PDF_AUTHOR')) { + define ('PDF_AUTHOR', 'TCPDF'); +} + +if (!defined('PDF_HEADER_TITLE')) { + define ('PDF_HEADER_TITLE', 'TCPDF Example'); +} + +if (!defined('PDF_HEADER_STRING')) { + define ('PDF_HEADER_STRING', "by Nicola Asuni - Tecnick.com\nwww.tcpdf.org"); +} + +if (!defined('PDF_UNIT')) { + define ('PDF_UNIT', 'mm'); +} + +if (!defined('PDF_MARGIN_HEADER')) { + define ('PDF_MARGIN_HEADER', 5); +} + +if (!defined('PDF_MARGIN_FOOTER')) { + define ('PDF_MARGIN_FOOTER', 10); +} + +if (!defined('PDF_MARGIN_TOP')) { + define ('PDF_MARGIN_TOP', 27); +} + +if (!defined('PDF_MARGIN_BOTTOM')) { + define ('PDF_MARGIN_BOTTOM', 25); +} + +if (!defined('PDF_MARGIN_LEFT')) { + define ('PDF_MARGIN_LEFT', 15); +} + +if (!defined('PDF_MARGIN_RIGHT')) { + define ('PDF_MARGIN_RIGHT', 15); +} + +if (!defined('PDF_FONT_NAME_MAIN')) { + define ('PDF_FONT_NAME_MAIN', 'helvetica'); +} + +if (!defined('PDF_FONT_SIZE_MAIN')) { + define ('PDF_FONT_SIZE_MAIN', 10); +} + +if (!defined('PDF_FONT_NAME_DATA')) { + define ('PDF_FONT_NAME_DATA', 'helvetica'); +} + +if (!defined('PDF_FONT_SIZE_DATA')) { + define ('PDF_FONT_SIZE_DATA', 8); +} + +if (!defined('PDF_FONT_MONOSPACED')) { + define ('PDF_FONT_MONOSPACED', 'courier'); +} + +if (!defined('PDF_IMAGE_SCALE_RATIO')) { + define ('PDF_IMAGE_SCALE_RATIO', 1.25); +} + +if (!defined('HEAD_MAGNIFICATION')) { + define('HEAD_MAGNIFICATION', 1.1); +} + +if (!defined('K_CELL_HEIGHT_RATIO')) { + define('K_CELL_HEIGHT_RATIO', 1.25); +} + +if (!defined('K_TITLE_MAGNIFICATION')) { + define('K_TITLE_MAGNIFICATION', 1.3); +} + +if (!defined('K_SMALL_RATIO')) { + define('K_SMALL_RATIO', 2/3); +} + +if (!defined('K_THAI_TOPCHARS')) { + define('K_THAI_TOPCHARS', true); +} + +if (!defined('K_TCPDF_CALLS_IN_HTML')) { + define('K_TCPDF_CALLS_IN_HTML', true); +} + +if (!defined('K_TCPDF_THROW_EXCEPTION_ERROR')) { + define('K_TCPDF_THROW_EXCEPTION_ERROR', false); +} + +if (!defined('K_TIMEZONE')) { + define('K_TIMEZONE', @date_default_timezone_get()); +} +date_default_timezone_set(K_TIMEZONE); + +//============================================================+ +// END OF FILE +//============================================================+ -- cgit v1.2.3