source: trunk/filemanager/tp/dompdf/dompdf_config.inc.php @ 2000

Revision 2000, 14.5 KB checked in by amuller, 14 years ago (diff)

Ticket #597 - Implementação do módulo gerenciador de arquivos

Line 
1<?php
2/**
3 * DOMPDF - PHP5 HTML to PDF renderer
4 *
5 * File: $RCSfile: dompdf_config.inc.php,v $
6 * Created on: 2004-08-04
7 *
8 * Copyright (c) 2004 - Benj Carson <benjcarson@digitaljunkies.ca>
9 *
10 * This library is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Lesser General Public
12 * License as published by the Free Software Foundation; either
13 * version 2.1 of the License, or (at your option) any later version.
14 *
15 * This library is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18 * Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with this library in the file LICENSE.LGPL; if not, write to the
22 * Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
23 * 02111-1307 USA
24 *
25 * Alternatively, you may distribute this software under the terms of the
26 * PHP License, version 3.0 or later.  A copy of this license should have
27 * been distributed with this file in the file LICENSE.PHP .  If this is not
28 * the case, you can obtain a copy at http://www.php.net/license/3_0.txt.
29 *
30 * The latest version of DOMPDF might be available at:
31 * http://www.digitaljunkies.ca/dompdf
32 *
33 * @link http://www.digitaljunkies.ca/dompdf
34 * @copyright 2004 Benj Carson
35 * @author Benj Carson <benjcarson@digitaljunkies.ca>
36 * @contributor Helmut Tischer <htischer@weihenstephan.org>
37 * @package dompdf
38 * @version 0.5.1
39 *
40 * Changes
41 * @contributor Helmut Tischer <htischer@weihenstephan.org>
42 * @version 0.5.1.htischer.20090507
43 * - Allow overriding of configuration settings by calling php script.
44 *   This allows replacing of dompdf by a new version in an application
45 *   without any modification,
46 * - Optionally separate font cache folder from font folder.
47 *   This allows write protecting the entire installation
48 * - Add settings to enable/disable additional debug output categories
49 * - Change some defaults to more practical values
50 * - Add comments about configuration parameter implications
51 */
52
53/* $Id: dompdf_config.inc.php 186 2009-10-19 22:42:06Z eclecticgeek@gmail.com $ */
54
55//error_reporting(E_STRICT | E_ALL);
56
57/**
58 * The root of your DOMPDF installation
59 */
60define("DOMPDF_DIR", str_replace(DIRECTORY_SEPARATOR, '/', realpath(dirname(__FILE__))));
61
62/**
63 * The location of the DOMPDF include directory
64 */
65define("DOMPDF_INC_DIR", DOMPDF_DIR . "/include");
66
67/**
68 * The location of the DOMPDF lib directory
69 */
70define("DOMPDF_LIB_DIR", DOMPDF_DIR . "/lib");
71
72//FIXME: Some function definitions rely on the constants defined by DOMPDF. However, might this location prove problematic?
73require_once(DOMPDF_INC_DIR . "/functions.inc.php");
74
75/**
76 * The location of the DOMPDF font directory
77 *
78 * If DOMPDF_FONT_DIR identical to DOMPDF_FONT_CACHE or user executing DOMPDF from the CLI,
79 * this directory must be writable by the webserver process ().
80 * *Please note the trailing slash.*
81 *
82 * Notes regarding fonts:
83 * Additional .afm font metrics can be added by executing load_font.php from command line.
84 * Converting ttf fonts to afm requires the external tool referenced by TTF2AFM
85 *
86 * Only the original "Base 14 fonts" are present on all pdf viewers. Additional fonts must
87 * be embedded in the pdf file or the PDF may not display correctly. This can significantly
88 * increase file size and could violate copyright provisions of a font. Font embedding is
89 * not currently supported (? via HT).
90 *
91 * Any font specification in the source HTML is translated to the closest font available
92 * in the font directory.
93 *
94 * The pdf standard "Base 14 fonts" are:
95 * Courier, Courier-Bold, Courier-BoldOblique, Courier-Oblique,
96 * Helvetica, Helvetica-Bold, Helvetica-BoldOblique, Helvetica-Oblique,
97 * Times-Roman, Times-Bold, Times-BoldItalic, Times-Italic,
98 * Symbol,
99 * ZapfDingbats,
100 *
101 * *Please note the trailing slash.*
102 */
103define("DOMPDF_FONT_DIR", DOMPDF_DIR . "/lib/fonts/");
104
105/**
106 * The location of the DOMPDF font cache directory
107 *
108 * Note this directory must be writable by the webserver process
109 * This folder must already exist!
110 * It contains the .afm files, on demand parsed, converted to php syntax and cached
111 * This folder can be the same as DOMPDF_FONT_DIR
112 *
113 * *Please note the trailing slash.*
114 */
115
116if (!defined("DOMPDF_FONT_CACHE")) {
117  define("DOMPDF_FONT_CACHE", DOMPDF_FONT_DIR);
118}
119
120/**
121 * The location of a temporary directory.
122 *
123 * The directory specified must be writeable by the webserver process.
124 * The temporary directory is required to download remote images and when
125 * using the PFDLib back end.
126 */
127if (!defined('DOMPDF_TEMP_DIR')) {
128  define("DOMPDF_TEMP_DIR", sys_get_temp_dir());
129}
130
131/**
132 * ==== IMPORTANT ====
133 *
134 * dompdf's "chroot": Prevents dompdf from accessing system files or other
135 * files on the webserver.  All local files opened by dompdf must be in a
136 * subdirectory of this directory.  DO NOT set it to '/' since this could
137 * allow an attacker to use dompdf to read any files on the server.  This
138 * should be an absolute path.
139 * This is only checked on command line call by dompdf.php, but not by
140 * direct class use like:
141 * $dompdf = new DOMPDF();      $dompdf->load_html($htmldata); $dompdf->render(); $pdfdata = $dompdf->output();
142 */
143if (!defined("DOMPDF_CHROOT")) {
144  define("DOMPDF_CHROOT", realpath(DOMPDF_DIR));
145}
146
147/**
148 * Whether to use Unicode fonts or not.
149 *
150 * When set to true the PDF backend must be set to "CPDF" and fonts must be
151 * loaded via the modified ttf2ufm tool included with dompdf (see below).
152 * Unicode font metric files (with .ufm extensions) must be created with
153 * ttf2ufm.  load_font.php should do this for you if the TTF2AFM define below
154 * points to the modified ttf2ufm tool included with dompdf.
155 *
156 * When enabled, dompdf can support all Unicode glyphs.  Any glyphs used in a
157 * document must be present in your fonts, however.
158 *
159 */
160if (!defined("DOMPDF_UNICODE_ENABLED")) {
161  define("DOMPDF_UNICODE_ENABLED", false);
162}
163
164/**
165 * The path to the tt2pt1 utility (used to convert ttf to afm)
166 *
167 * Not strictly necessary, but useful if you would like to install
168 * additional fonts using the {@link load_font.php} utility.
169 *
170 * Windows users should use something like this:
171 * define("TTF2AFM", "C:\\Program Files\\Ttf2Pt1\\bin\\ttf2pt1.exe");
172 *
173 * @link http://ttf2pt1.sourceforge.net/
174 */
175if (!defined("TTF2AFM")) {
176  define("TTF2AFM", DOMPDF_LIB_DIR ."/ttf2ufm/ttf2ufm-src/ttf2pt1");
177  //define("TTF2AFM", "/usr/bin/ttf2pt1");
178}
179
180/**
181 * The PDF rendering backend to use
182 *
183 * Valid settings are 'PDFLib', 'CPDF' (the bundled R&OS PDF class), 'GD' and
184 * 'auto'.  'auto' will look for PDFLib and use it if found, or if not it will
185 * fall back on CPDF.  'GD' renders PDFs to graphic files.  {@link
186 * Canvas_Factory} ultimately determines which rendering class to instantiate
187 * based on this setting.
188 *
189 * Both PDFLib & CPDF rendering backends provide sufficient rendering
190 * capabilities for dompdf, however additional features (e.g. object,
191 * image and font support, etc.) differ between backends.  Please see
192 * {@link PDFLib_Adapter} for more information on the PDFLib backend
193 * and {@link CPDF_Adapter} and lib/class.pdf.php for more information
194 * on CPDF.  Also see the documentation for each backend at the links
195 * below.
196 *
197 * The GD rendering backend is a little different than PDFLib and
198 * CPDF.  Several features of CPDF and PDFLib are not supported or do
199 * not make any sense when creating image files.  For example,
200 * multiple pages are not supported, nor are PDF 'objects'.  Have a
201 * look at {@link GD_Adapter} for more information.  GD support is new
202 * and experimental, so use it at your own risk.
203 *
204 * @link http://www.pdflib.com
205 * @link http://www.ros.co.nz/pdf
206 * @link http://www.php.net/image
207 */
208if (!defined("DOMPDF_PDF_BACKEND")) {
209  define("DOMPDF_PDF_BACKEND", "CPDF");
210}
211
212/**
213 * PDFlib license key
214 *
215 * If you are using a licensed, commercial version of PDFlib, specify
216 * your license key here.  If you are using PDFlib-Lite or are evaluating
217 * the commercial version of PDFlib, comment out this setting.
218 *
219 * @link http://www.pdflib.com
220 *
221 * If pdflib present in web server and auto or selected explicitely above,
222 * a real license code must exist!
223 */
224if (!defined("DOMPDF_PDFLIB_LICENSE")) {
225  #define("DOMPDF_PDFLIB_LICENSE", "your license key here");
226}
227
228/**
229 * html target media view which should be rendered into pdf.
230 * List of types and parsing rules for future extensions:
231 * http://www.w3.org/TR/REC-html40/types.html
232 *   screen, tty, tv, projection, handheld, print, braille, aural, all
233 * Note: aural is deprecated in CSS 2.1 because it is replaced by speech in CSS 3.
234 * Note, even though the generated pdf file is intended for print output,
235 * the desired content might be different (e.g. screen or projection view of html file).
236 * Therefore allow specification of content here.
237 */
238if (!defined("DOMPDF_DEFAULT_MEDIA_TYPE")) {
239  define("DOMPDF_DEFAULT_MEDIA_TYPE", "screen");
240}
241
242/**
243 * The default paper size.
244 *
245 * North America standard is "letter"; other countries generally "a4"
246 *
247 * @see CPDF_Adapter::PAPER_SIZES for valid sizes
248 */
249if (!defined("DOMPDF_DEFAULT_PAPER_SIZE")) {
250  define("DOMPDF_DEFAULT_PAPER_SIZE", "letter");
251}
252
253
254/**
255 * The default font family
256 *
257 * Used if no suitable fonts can be found. This must exist in the font folder.
258 * @var string
259 */
260if (!defined("DOMPDF_DEFAULT_FONT")) {
261  define("DOMPDF_DEFAULT_FONT", "serif");
262}
263/**
264 * Image DPI setting
265 *
266 * This setting determines the default DPI setting for images and fonts.  The
267 * DPI may be overridden for inline images by explictly setting the
268 * image's width & height style attributes (i.e. if the image's native
269 * width is 600 pixels and you specify the image's width as 72 points,
270 * the image will have a DPI of 600 in the rendered PDF.  The DPI of
271 * background images can not be overridden and is controlled entirely
272 * via this parameter.
273 *
274 * For the purposes of DOMPDF, pixels per inch (PPI) = dots per inch (DPI).
275 * If a size in html is given as px (or without unit as image size),
276 * this tells the corresponding size in pt.
277 * This adjusts the relative sizes to be similar to the rendering of the
278 * html page in a reference browser.
279 *
280 * In pdf, always 1 pt = 1/72 inch
281 *
282 * Rendering resolution of various browsers in px per inch:
283 * Windows Firefox and Internet Explorer:
284 *   SystemControl->Display properties->FontResolution: Default:96, largefonts:120, custom:?
285 * Linux Firefox:
286 *   about:config *resolution: Default:96
287 *   (xorg screen dimension in mm and Desktop font dpi settings are ignored)
288 *
289 * Take care about extra font/image zoom factor of browser.
290 *
291 * In images, <img> size in pixel attribute, img css style, are overriding
292 * the real image dimension in px for rendering.
293 *
294 * @var int
295 */
296if (!defined("DOMPDF_DPI")) {
297  define("DOMPDF_DPI", "96");
298}
299
300/**
301 * Enable inline PHP
302 *
303 * If this setting is set to true then DOMPDF will automatically evaluate
304 * inline PHP contained within <script type="text/php"> ... </script> tags.
305 *
306 * Enabling this for documents you do not trust (e.g. arbitrary remote html
307 * pages) is a security risk.  Set this option to false if you wish to process
308 * untrusted documents.
309 *
310 * @var bool
311 */
312if (!defined("DOMPDF_ENABLE_PHP")) {
313  define("DOMPDF_ENABLE_PHP", true);
314}
315
316/**
317 * Enable remote file access
318 *
319 * If this setting is set to true, DOMPDF will access remote sites for
320 * images and CSS files as required.
321 * This is required for part of test case www/test/image_variants.html through www/examples.php
322 *
323 * Attention!
324 * This can be a security risk, in particular in combination with DOMPDF_ENABLE_PHP and
325 * allowing remote access to dompdf.php or on allowing remote html code to be passed to
326 * $dompdf = new DOMPDF(); $dompdf->load_html(...);
327 * This allows anonymous users to download legally doubtful internet content which on
328 * tracing back appears to being downloaded by your server, or allows malicious php code
329 * in remote html pages to be executed by your server with your account privileges.
330 *
331 * @var bool
332 */
333if (!defined("DOMPDF_ENABLE_REMOTE")) {
334  define("DOMPDF_ENABLE_REMOTE", false);
335}
336 
337/**
338 * DOMPDF autoload function
339 *
340 * If you have an existing autoload function, add a call to this function
341 * from your existing __autoload() implementation.
342 *
343 * TODO: use spl_autoload(), if available
344 *
345 * @param string $class
346 */
347function DOMPDF_autoload($class) {
348  $filename = DOMPDF_INC_DIR . "/" . mb_strtolower($class) . ".cls.php";
349 
350  if ( is_file($filename) )
351    require_once($filename);
352}
353
354if ( function_exists("spl_autoload_register") ) {
355
356   spl_autoload_register("DOMPDF_autoload");
357
358} else if ( !function_exists("__autoload") ) {
359  /**
360   * Default __autoload() function
361   *
362   * @param string $class
363   */
364  function __autoload($class) {
365    DOMPDF_autoload($class);
366  }
367}
368
369// ### End of user-configurable options ###
370
371
372/**
373 * Ensure that PHP is working with text internally using UTF8 character encoding.
374 */
375mb_internal_encoding('UTF-8');
376
377/**
378 * Global array of warnings generated by DomDocument parser and
379 * stylesheet class
380 *
381 * @var array
382 */
383$_dompdf_warnings = array();
384
385/**
386 * If true, $_dompdf_warnings is dumped on script termination when using
387 * dompdf/dompdf.php or after rendering when using the DOMPDF class.
388 * When using the class, setting this value to true will prevent you from
389 * streaming the PDF.
390 *
391 * @var bool
392 */
393$_dompdf_show_warnings = false;
394
395/**
396 * If true, the entire tree is dumped to stdout in dompdf.cls.php.
397 * Setting this value to true will prevent you from streaming the PDF.
398 *
399 * @var bool
400 */
401$_dompdf_debug = false;
402
403/**
404 * Array of enabled debug message types
405 *
406 * @var array
407 */
408$_DOMPDF_DEBUG_TYPES = array(); //array("page-break" => 1);
409
410/* Optionally enable different classes of debug output before the pdf content.
411 * Visible if displaying pdf as text,
412 * E.g. on repeated display of same pdf in browser when pdf is not taken out of
413 * the browser cache and the premature output prevents setting of the mime type.
414 */
415if (!defined('DEBUGPNG')) {
416  define('DEBUGPNG',0);
417}
418if (!defined('DEBUGKEEPTEMP')) {
419  define('DEBUGKEEPTEMP',0);
420}
421if (!defined('DEBUGCSS')) {
422  define('DEBUGCSS',0);
423}
424?>
Note: See TracBrowser for help on using the repository browser.