41 if (!defined(
'K_TCPDF_EXTERNAL_CONFIG')) {
44 if ((!isset($_SERVER[
'DOCUMENT_ROOT'])) OR (empty($_SERVER[
'DOCUMENT_ROOT']))) {
45 if(isset($_SERVER[
'SCRIPT_FILENAME'])) {
46 $_SERVER[
'DOCUMENT_ROOT'] = str_replace(
'\\',
'/', substr($_SERVER[
'SCRIPT_FILENAME'], 0, 0-strlen($_SERVER[
'PHP_SELF'])));
47 } elseif(isset($_SERVER[
'PATH_TRANSLATED'])) {
48 $_SERVER[
'DOCUMENT_ROOT'] = str_replace(
'\\',
'/', substr(str_replace(
'\\\\',
'\\', $_SERVER[
'PATH_TRANSLATED']), 0, 0-strlen($_SERVER[
'PHP_SELF'])));
51 $_SERVER[
'DOCUMENT_ROOT'] =
'/';
55 $_SERVER[
'DOCUMENT_ROOT'] = str_replace(
'//',
'/', $_SERVER[
'DOCUMENT_ROOT'].
'/');
63 $tcpdf_install_dirs = array();
64 if (strpos(dirname(__FILE__),
'/config') !==
false) {
66 $k_path_main_default = str_replace(
'\\',
'/', realpath(substr(dirname(__FILE__), 0, 0-strlen(
'config'))));
67 if (substr($k_path_main_default, -1) !=
'/') {
68 $k_path_main_default .=
'/';
70 $tcpdf_install_dirs[] = $k_path_main_default;
72 $tcpdf_install_dirs += array(
'/usr/share/php/tcpdf/',
'/usr/share/tcpdf/',
'/usr/share/php-tcpdf/',
'/var/www/tcpdf/',
'/var/www/html/tcpdf/',
'/usr/local/apache2/htdocs/tcpdf/');
73 foreach ($tcpdf_install_dirs as $k_path_main) {
74 if (file_exists($k_path_main.
'tcpdf.php')) {
79 } $k_path_main = dirname(dirname(__FILE__)).
'/';
81 if (!file_exists($k_path_main)) {
82 die(
'TCPDF ERROR: please set the correct path to TCPDF on the configuration file');
90 define (
'K_PATH_MAIN', $k_path_main);
95 $k_path_url = $k_path_main;
96 if (isset($_SERVER[
'HTTP_HOST']) AND (!empty($_SERVER[
'HTTP_HOST']))) {
97 if(isset($_SERVER[
'HTTPS']) AND (!empty($_SERVER[
'HTTPS'])) AND (strtolower($_SERVER[
'HTTPS']) !=
'off')) {
98 $k_path_url =
'https://';
100 $k_path_url =
'http://';
102 $k_path_url .= $_SERVER[
'HTTP_HOST'];
103 $k_path_url .= str_replace(
'\\',
'/', substr(K_PATH_MAIN, (strlen($_SERVER[
'DOCUMENT_ROOT']) - 1)));
111 define (
'K_PATH_URL', $k_path_url);
116 define (
'K_PATH_CACHE', sys_get_temp_dir().
'/');
121 define (
'K_PATH_FONTS', K_PATH_MAIN.
'fonts/');
126 define (
'K_PATH_IMAGES', K_PATH_MAIN.
'examples/images/');
131 define (
'K_BLANK_IMAGE', K_PATH_IMAGES.
'_blank.png');
136 define (
'PDF_PAGE_FORMAT',
'A4');
141 define (
'PDF_PAGE_ORIENTATION',
'P');
146 define (
'PDF_CREATOR',
'TCPDF');
151 define (
'PDF_AUTHOR',
'TCPDF');
156 define (
'PDF_HEADER_TITLE',
'TCPDF Example');
161 define (
'PDF_HEADER_STRING',
"by Nicola Asuni - Tecnick.com\nwww.tcpdf.org");
166 define (
'PDF_HEADER_LOGO',
'tcpdf_logo.jpg');
171 define (
'PDF_HEADER_LOGO_WIDTH', 30);
176 define (
'PDF_UNIT',
'mm');
181 define (
'PDF_MARGIN_HEADER', 5);
186 define (
'PDF_MARGIN_FOOTER', 10);
191 define (
'PDF_MARGIN_TOP', 27);
196 define (
'PDF_MARGIN_BOTTOM', 25);
201 define (
'PDF_MARGIN_LEFT', 15);
206 define (
'PDF_MARGIN_RIGHT', 15);
211 define (
'PDF_FONT_NAME_MAIN',
'helvetica');
216 define (
'PDF_FONT_SIZE_MAIN', 10);
221 define (
'PDF_FONT_NAME_DATA',
'helvetica');
226 define (
'PDF_FONT_SIZE_DATA', 8);
231 define (
'PDF_FONT_MONOSPACED',
'courier');
236 define (
'PDF_IMAGE_SCALE_RATIO', 1.25);
241 define(
'HEAD_MAGNIFICATION', 1.1);
246 define(
'K_CELL_HEIGHT_RATIO', 1.25);
251 define(
'K_TITLE_MAGNIFICATION', 1.3);
256 define(
'K_SMALL_RATIO', 2/3);
261 define(
'K_THAI_TOPCHARS',
true);
267 define(
'K_TCPDF_CALLS_IN_HTML',
true);
272 define(
'K_TCPDF_THROW_EXCEPTION_ERROR',
false);