|
2 | 2 | //============================================================+
|
3 | 3 | // File name : tcpdf_config.php
|
4 | 4 | // Begin : 2004-06-11
|
5 |
| -// Last Update : 2013-02-06 |
| 5 | +// Last Update : 2013-05-14 |
6 | 6 | //
|
7 | 7 | // Description : Configuration file for TCPDF.
|
8 | 8 | // Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - [email protected]
|
|
51 | 51 | $_SERVER['DOCUMENT_ROOT'] = '/';
|
52 | 52 | }
|
53 | 53 | }
|
54 |
| - |
55 | 54 | // be sure that the end slash is present
|
56 | 55 | $_SERVER['DOCUMENT_ROOT'] = str_replace('//', '/', $_SERVER['DOCUMENT_ROOT'].'/');
|
57 | 56 |
|
58 |
| - // Automatic calculation for the following K_PATH_MAIN constant |
59 |
| - $k_path_main = str_replace( '\\', '/', realpath(substr(dirname(__FILE__), 0, 0-strlen('config')))); |
60 |
| - if (substr($k_path_main, -1) != '/') { |
61 |
| - $k_path_main .= '/'; |
| 57 | + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
| 58 | + // Try to automatically set the value for the following K_PATH_MAIN constant. |
| 59 | + // NOTE: delete this section and manually set the K_PATH_MAIN constant below for better performances. |
| 60 | + $tcpdf_install_dirs = array(); |
| 61 | + if (strpos(dirname(__FILE__), '/config') !== false) { |
| 62 | + // default config file |
| 63 | + $k_path_main_default = str_replace( '\\', '/', realpath(substr(dirname(__FILE__), 0, 0-strlen('config')))); |
| 64 | + if (substr($k_path_main_default, -1) != '/') { |
| 65 | + $k_path_main_default .= '/'; |
| 66 | + } |
| 67 | + $tcpdf_install_dirs[] = $k_path_main_default; |
| 68 | + } |
| 69 | + $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/'); |
| 70 | + foreach ($tcpdf_install_dirs as $k_path_main) { |
| 71 | + if (file_exists($k_path_main.'tcpdf.php')) { |
| 72 | + break; |
| 73 | + } |
| 74 | + } |
| 75 | + if (!file_exists($k_path_main)) { |
| 76 | + die('TCPDF ERROR: please set the correct path to TCPDF on the configuration file'); |
62 | 77 | }
|
| 78 | + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
63 | 79 |
|
64 | 80 | /**
|
65 | 81 | * Installation path (/var/www/tcpdf/).
|
66 | 82 | * By default it is automatically calculated but you can also set it as a fixed string to improve performances.
|
67 | 83 | */
|
68 | 84 | define ('K_PATH_MAIN', $k_path_main);
|
69 |
| - |
70 |
| - // Automatic calculation for the following K_PATH_URL constant |
| 85 | + |
| 86 | + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
| 87 | + // Try to automatically set the value for the following K_PATH_URL constant. |
| 88 | + // NOTE: delete this section and manually set the K_PATH_URL constant below for better performances. |
71 | 89 | $k_path_url = $k_path_main; // default value for console mode
|
72 | 90 | if (isset($_SERVER['HTTP_HOST']) AND (!empty($_SERVER['HTTP_HOST']))) {
|
73 |
| - if(isset($_SERVER['HTTPS']) AND (!empty($_SERVER['HTTPS'])) AND strtolower($_SERVER['HTTPS'])!='off') { |
| 91 | + if(isset($_SERVER['HTTPS']) AND (!empty($_SERVER['HTTPS'])) AND (strtolower($_SERVER['HTTPS']) != 'off')) { |
74 | 92 | $k_path_url = 'https://';
|
75 | 93 | } else {
|
76 | 94 | $k_path_url = 'http://';
|
77 | 95 | }
|
78 | 96 | $k_path_url .= $_SERVER['HTTP_HOST'];
|
79 | 97 | $k_path_url .= str_replace( '\\', '/', substr(K_PATH_MAIN, (strlen($_SERVER['DOCUMENT_ROOT']) - 1)));
|
80 | 98 | }
|
| 99 | + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
81 | 100 |
|
82 | 101 | /**
|
83 | 102 | * URL path to tcpdf installation folder (http://localhost/tcpdf/).
|
84 |
| - * By default it is automatically calculated but you can also set it as a fixed string to improve performances. |
| 103 | + * By default it is automatically set but you can also set it as a fixed string to improve performances. |
85 | 104 | */
|
86 | 105 | define ('K_PATH_URL', $k_path_url);
|
87 | 106 |
|
88 | 107 | /**
|
89 |
| - * path for PDF fonts |
90 |
| - * use K_PATH_MAIN.'fonts/old/' for old non-UTF8 fonts |
91 |
| - */ |
92 |
| - define ('K_PATH_FONTS', K_PATH_MAIN.'fonts/'); |
93 |
| - |
94 |
| - /** |
95 |
| - * cache directory for temporary files (full path) |
| 108 | + * Cache directory for temporary files (full path). |
96 | 109 | */
|
97 |
| - define ('K_PATH_CACHE', K_PATH_MAIN.'cache/'); |
| 110 | + define ('K_PATH_CACHE', sys_get_temp_dir().'/'); |
98 | 111 |
|
99 | 112 | /**
|
100 |
| - * cache directory for temporary files (url path) |
| 113 | + * Path for PDF fonts. |
101 | 114 | */
|
102 |
| - define ('K_PATH_URL_CACHE', K_PATH_URL.'cache/'); |
| 115 | + define ('K_PATH_FONTS', K_PATH_MAIN.'fonts/'); |
103 | 116 |
|
104 | 117 | /**
|
105 |
| - *images directory |
| 118 | + * Default images directory. |
106 | 119 | */
|
107 |
| - define ('K_PATH_IMAGES', K_PATH_MAIN.'images/'); |
| 120 | + define ('K_PATH_IMAGES', K_PATH_MAIN.'examples/images/'); |
108 | 121 |
|
109 | 122 | /**
|
110 |
| - * blank image |
| 123 | + * Blank image. |
111 | 124 | */
|
112 | 125 | define ('K_BLANK_IMAGE', K_PATH_IMAGES.'_blank.png');
|
113 | 126 |
|
114 | 127 | /**
|
115 |
| - * page format |
| 128 | + * Page format. |
116 | 129 | */
|
117 | 130 | define ('PDF_PAGE_FORMAT', 'A4');
|
118 | 131 |
|
119 | 132 | /**
|
120 |
| - * page orientation (P=portrait, L=landscape) |
| 133 | + * Page orientation (P=portrait, L=landscape). |
121 | 134 | */
|
122 | 135 | define ('PDF_PAGE_ORIENTATION', 'P');
|
123 | 136 |
|
124 | 137 | /**
|
125 |
| - * document creator |
| 138 | + * Document creator. |
126 | 139 | */
|
127 | 140 | define ('PDF_CREATOR', 'TCPDF');
|
128 | 141 |
|
129 | 142 | /**
|
130 |
| - * document author |
| 143 | + * Document author. |
131 | 144 | */
|
132 | 145 | define ('PDF_AUTHOR', 'TCPDF');
|
133 | 146 |
|
134 | 147 | /**
|
135 |
| - * header title |
| 148 | + * Header title. |
136 | 149 | */
|
137 | 150 | define ('PDF_HEADER_TITLE', 'TCPDF Example');
|
138 | 151 |
|
139 | 152 | /**
|
140 |
| - * header description string |
| 153 | + * Header description string. |
141 | 154 | */
|
142 | 155 | define ('PDF_HEADER_STRING', "by Nicola Asuni - Tecnick.com\nwww.tcpdf.org");
|
143 | 156 |
|
144 | 157 | /**
|
145 |
| - * image logo |
| 158 | + * Image logo. |
146 | 159 | */
|
147 | 160 | define ('PDF_HEADER_LOGO', 'tcpdf_logo.jpg');
|
148 | 161 |
|
149 | 162 | /**
|
150 |
| - * header logo image width [mm] |
| 163 | + * Header logo image width [mm]. |
151 | 164 | */
|
152 | 165 | define ('PDF_HEADER_LOGO_WIDTH', 30);
|
153 | 166 |
|
154 | 167 | /**
|
155 |
| - * document unit of measure [pt=point, mm=millimeter, cm=centimeter, in=inch] |
| 168 | + * Document unit of measure [pt=point, mm=millimeter, cm=centimeter, in=inch]. |
156 | 169 | */
|
157 | 170 | define ('PDF_UNIT', 'mm');
|
158 | 171 |
|
159 | 172 | /**
|
160 |
| - * header margin |
| 173 | + * Header margin. |
161 | 174 | */
|
162 | 175 | define ('PDF_MARGIN_HEADER', 5);
|
163 | 176 |
|
164 | 177 | /**
|
165 |
| - * footer margin |
| 178 | + * Footer margin. |
166 | 179 | */
|
167 | 180 | define ('PDF_MARGIN_FOOTER', 10);
|
168 | 181 |
|
169 | 182 | /**
|
170 |
| - * top margin |
| 183 | + * Top margin. |
171 | 184 | */
|
172 | 185 | define ('PDF_MARGIN_TOP', 27);
|
173 | 186 |
|
174 | 187 | /**
|
175 |
| - * bottom margin |
| 188 | + * Bottom margin. |
176 | 189 | */
|
177 | 190 | define ('PDF_MARGIN_BOTTOM', 25);
|
178 | 191 |
|
179 | 192 | /**
|
180 |
| - * left margin |
| 193 | + * Left margin. |
181 | 194 | */
|
182 | 195 | define ('PDF_MARGIN_LEFT', 15);
|
183 | 196 |
|
184 | 197 | /**
|
185 |
| - * right margin |
| 198 | + * Right margin. |
186 | 199 | */
|
187 | 200 | define ('PDF_MARGIN_RIGHT', 15);
|
188 | 201 |
|
189 | 202 | /**
|
190 |
| - * default main font name |
| 203 | + * Default main font name. |
191 | 204 | */
|
192 | 205 | define ('PDF_FONT_NAME_MAIN', 'helvetica');
|
193 | 206 |
|
194 | 207 | /**
|
195 |
| - * default main font size |
| 208 | + * Default main font size. |
196 | 209 | */
|
197 | 210 | define ('PDF_FONT_SIZE_MAIN', 10);
|
198 | 211 |
|
199 | 212 | /**
|
200 |
| - * default data font name |
| 213 | + * Default data font name. |
201 | 214 | */
|
202 | 215 | define ('PDF_FONT_NAME_DATA', 'helvetica');
|
203 | 216 |
|
204 | 217 | /**
|
205 |
| - * default data font size |
| 218 | + * Default data font size. |
206 | 219 | */
|
207 | 220 | define ('PDF_FONT_SIZE_DATA', 8);
|
208 | 221 |
|
209 | 222 | /**
|
210 |
| - * default monospaced font name |
| 223 | + * Default monospaced font name. |
211 | 224 | */
|
212 | 225 | define ('PDF_FONT_MONOSPACED', 'courier');
|
213 | 226 |
|
214 | 227 | /**
|
215 |
| - * ratio used to adjust the conversion of pixels to user units |
| 228 | + * Ratio used to adjust the conversion of pixels to user units. |
216 | 229 | */
|
217 | 230 | define ('PDF_IMAGE_SCALE_RATIO', 1.25);
|
218 | 231 |
|
219 | 232 | /**
|
220 |
| - * magnification factor for titles |
| 233 | + * Magnification factor for titles. |
221 | 234 | */
|
222 | 235 | define('HEAD_MAGNIFICATION', 1.1);
|
223 | 236 |
|
224 | 237 | /**
|
225 |
| - * height of cell respect font height |
| 238 | + * Height of cell respect font height. |
226 | 239 | */
|
227 | 240 | define('K_CELL_HEIGHT_RATIO', 1.25);
|
228 | 241 |
|
229 | 242 | /**
|
230 |
| - * title magnification respect main font size |
| 243 | + * Title magnification respect main font size. |
231 | 244 | */
|
232 | 245 | define('K_TITLE_MAGNIFICATION', 1.3);
|
233 | 246 |
|
234 | 247 | /**
|
235 |
| - * reduction factor for small font |
| 248 | + * Reduction factor for small font. |
236 | 249 | */
|
237 | 250 | define('K_SMALL_RATIO', 2/3);
|
238 | 251 |
|
239 | 252 | /**
|
240 |
| - * set to true to enable the special procedure used to avoid the overlappind of symbols on Thai language |
| 253 | + * Set to true to enable the special procedure used to avoid the overlappind of symbols on Thai language. |
241 | 254 | */
|
242 | 255 | define('K_THAI_TOPCHARS', true);
|
243 | 256 |
|
244 | 257 | /**
|
245 |
| - * if true allows to call TCPDF methods using HTML syntax |
| 258 | + * If true allows to call TCPDF methods using HTML syntax |
246 | 259 | * IMPORTANT: For security reason, disable this feature if you are printing user HTML content.
|
247 | 260 | */
|
248 | 261 | define('K_TCPDF_CALLS_IN_HTML', true);
|
249 | 262 |
|
250 | 263 | /**
|
251 |
| - * if true adn PHP version is greater than 5, then the Error() method throw new exception instead of terminating the execution. |
| 264 | + * If true adn PHP version is greater than 5, then the Error() method throw new exception instead of terminating the execution. |
252 | 265 | */
|
253 | 266 | define('K_TCPDF_THROW_EXCEPTION_ERROR', false);
|
254 | 267 | }
|
|
0 commit comments