security fix in master branch
[openemr.git] / library / html2pdf / _class / tcpdfConfig.php
blob64f43541e80c8e3fc1c79edb5664a9b110ce9bc2
1 <?php
2 //============================================================+
3 // File name : tcpdf_config.php
4 // Begin : 2004-06-11
5 // Last Update : 2013-02-06
6 //
7 // Description : Configuration file for TCPDF.
8 // Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - info@tecnick.com
9 // License : GNU-LGPL v3 (http://www.gnu.org/copyleft/lesser.html)
10 // -------------------------------------------------------------------
11 // Copyright (C) 2004-2013 Nicola Asuni - Tecnick.com LTD
13 // This file is part of TCPDF software library.
15 // TCPDF is free software: you can redistribute it and/or modify it
16 // under the terms of the GNU Lesser General Public License as
17 // published by the Free Software Foundation, either version 3 of the
18 // License, or (at your option) any later version.
20 // TCPDF is distributed in the hope that it will be useful, but
21 // WITHOUT ANY WARRANTY; without even the implied warranty of
22 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
23 // See the GNU Lesser General Public License for more details.
25 // You should have received a copy of the GNU Lesser General Public License
26 // along with TCPDF. If not, see <http://www.gnu.org/licenses/>.
28 // See LICENSE.TXT file for more information.
29 //============================================================+
31 /**
32 * Configuration file for TCPDF.
33 * @author Nicola Asuni
34 * @package com.tecnick.tcpdf
35 * @version 4.9.005
36 * @since 2004-10-27
39 // If you define the constant K_TCPDF_EXTERNAL_CONFIG, the following settings will be ignored.
41 if (!defined('K_TCPDF_EXTERNAL_CONFIG')) {
43 define('K_TCPDF_EXTERNAL_CONFIG', true);
45 // DOCUMENT_ROOT fix for IIS Webserver
46 if ((!isset($_SERVER['DOCUMENT_ROOT'])) OR (empty($_SERVER['DOCUMENT_ROOT']))) {
47 if (isset($_SERVER['SCRIPT_FILENAME'])) {
48 $_SERVER['DOCUMENT_ROOT'] = str_replace(
49 '\\',
50 '/',
51 substr($_SERVER['SCRIPT_FILENAME'], 0, 0-strlen($_SERVER['PHP_SELF']))
53 } elseif (isset($_SERVER['PATH_TRANSLATED'])) {
54 $_SERVER['DOCUMENT_ROOT'] = str_replace(
55 '\\',
56 '/',
57 substr(str_replace('\\\\', '\\', $_SERVER['PATH_TRANSLATED']), 0, 0-strlen($_SERVER['PHP_SELF']))
59 } else {
60 // define here your DOCUMENT_ROOT path if the previous fails (e.g. '/var/www')
61 $_SERVER['DOCUMENT_ROOT'] = '/var/www';
65 // be sure that the end slash is present
66 $_SERVER['DOCUMENT_ROOT'] = str_replace('//', '/', $_SERVER['DOCUMENT_ROOT'].'/');
68 /**
69 * Installation path of tcpdf with composer.
71 $vendorFolders = array(
72 dirname(dirname(__FILE__)) . '/vendor/',
73 dirname(dirname(__FILE__)) . '/../../',
75 foreach ($vendorFolders as $vendorFolder) {
76 if (file_exists($vendorFolder.'autoload.php')) {
77 $k_path_main = $vendorFolder . 'tecnickcom/tcpdf/';
79 break;
83 if (!isset($k_path_main)) {
84 echo "
85 [ERROR]
86 It seems that HTML2PDF dependencies are not installed...
87 you must install thems with `composer install`
90 exit;
92 define ('K_PATH_MAIN', $k_path_main);
94 // Automatic calculation for the following K_PATH_URL constant
95 $k_path_url = $k_path_main; // default value for console mode
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://';
99 } else {
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)));
107 * URL path to tcpdf installation folder (http://localhost/tcpdf/).
108 * By default it is automatically calculated but you can also set it as a fixed string to improve performances.
110 define ('K_PATH_URL', $k_path_url);
113 * path for PDF fonts
114 * use K_PATH_MAIN.'fonts/old/' for old non-UTF8 fonts
116 define('K_PATH_FONTS', K_PATH_MAIN.'fonts/');
119 * cache directory for temporary files (url path)
121 define('K_PATH_URL_CACHE', K_PATH_URL.'cache/');
124 *images directory
126 define('K_PATH_IMAGES', K_PATH_MAIN.'images/');
129 * blank image
131 define('K_BLANK_IMAGE', K_PATH_IMAGES.'_blank.png');
134 * page format
136 define('PDF_PAGE_FORMAT', 'A4');
139 * page orientation (P=portrait, L=landscape)
141 define('PDF_PAGE_ORIENTATION', 'P');
144 * document creator
146 define('PDF_CREATOR', 'HTML2PDF - TCPDF');
149 * document author
151 define('PDF_AUTHOR', 'HTML2PDF - TCPDF');
154 * header title
156 define('PDF_HEADER_TITLE', null);
159 * header description string
161 define('PDF_HEADER_STRING', null);
164 * image logo
166 define('PDF_HEADER_LOGO', null);
169 * header logo image width [mm]
171 define('PDF_HEADER_LOGO_WIDTH', null);
174 * document unit of measure [pt=point, mm=millimeter, cm=centimeter, in=inch]
176 define('PDF_UNIT', 'mm');
179 * header margin
181 define('PDF_MARGIN_HEADER', 0);
184 * footer margin
186 define('PDF_MARGIN_FOOTER', 0);
189 * top margin
191 define('PDF_MARGIN_TOP', 0);
194 * bottom margin
196 define('PDF_MARGIN_BOTTOM', 0);
199 * left margin
201 define('PDF_MARGIN_LEFT', 0);
204 * right margin
206 define('PDF_MARGIN_RIGHT', 0);
209 * default main font name
211 define('PDF_FONT_NAME_MAIN', 'helvetica');
214 * default main font size
216 define('PDF_FONT_SIZE_MAIN', 10);
219 * default data font name
221 define('PDF_FONT_NAME_DATA', 'helvetica');
224 * default data font size
226 define('PDF_FONT_SIZE_DATA', 8);
229 * default monospaced font name
231 define('PDF_FONT_MONOSPACED', 'courier');
234 * ratio used to adjust the conversion of pixels to user units
236 define('PDF_IMAGE_SCALE_RATIO', 1);
239 * magnification factor for titles
241 define('HEAD_MAGNIFICATION', 1);
244 * height of cell respect font height
246 define('K_CELL_HEIGHT_RATIO', 1);
249 * title magnification respect main font size
251 define('K_TITLE_MAGNIFICATION', 1);
254 * reduction factor for small font
256 define('K_SMALL_RATIO', 2/3);
259 * set to true to enable the special procedure used to avoid the overlappind of symbols on Thai language
261 define('K_THAI_TOPCHARS', true);
264 * if true allows to call TCPDF methods using HTML syntax
265 * IMPORTANT: For security reason, disable this feature if you are printing user HTML content.
267 define('K_TCPDF_CALLS_IN_HTML', false);
270 * if true and PHP version is greater than 5, then the Error() method throw new exception instead of terminating the execution.
272 define('K_TCPDF_THROW_EXCEPTION_ERROR', true);
275 //============================================================+
276 // END OF FILE
277 //============================================================+