DOMPDF安装选项

I'm working on installing dompdf http://code.google.com/p/dompdf/

It's going well, but the installation instructions are telling me to "edit dompdf_config.custom.inc.php (in version 0.6) or dompdf_config.inc.php (version 0.5) to fit your installation." I am not sure what lines I am supposed to uncomment. I am using it on an Ubuntu Server (10.04) with the generic lamp stack, intending to code in PHP.

Has anyone used this that can at least explain (at least some of) what the different options are.

<?php 
//define("DOMPDF_TEMP_DIR", "/tmp");
//define("DOMPDF_CHROOT", DOMPDF_DIR);
//define("DOMPDF_UNICODE_ENABLED", false);
//define("DOMPDF_PDF_BACKEND", "PDFLib");
//define("DOMPDF_DEFAULT_MEDIA_TYPE", "print");
//define("DOMPDF_DEFAULT_PAPER_SIZE", "letter");
//define("DOMPDF_DEFAULT_FONT", "serif");
//define("DOMPDF_DPI", 72);
//define("DOMPDF_ENABLE_PHP", true);
//define("DOMPDF_ENABLE_REMOTE", true);
//define("DOMPDF_ENABLE_CSS_FLOAT", true);
//define("DOMPDF_ENABLE_JAVASCRIPT", false);
//define("DEBUGPNG", true);
//define("DEBUGKEEPTEMP", true);
//define("DEBUGCSS", true);
//define("DEBUG_LAYOUT", true);
//define("DEBUG_LAYOUT_LINES", false);
//define("DEBUG_LAYOUT_BLOCKS", false);
//define("DEBUG_LAYOUT_INLINE", false);
//define("DOMPDF_FONT_HEIGHT_RATIO", 1.0);
//define("DEBUG_LAYOUT_PADDINGBOX", false);
//define("DOMPDF_LOG_OUTPUT_FILE", DOMPDF_FONT_DIR."log.htm");
//define("DOMPDF_ENABLE_HTML5PARSER", true);
//define("DOMPDF_ENABLE_FONTSUBSETTING", true);

// DOMPDF authentication
//define("DOMPDF_ADMIN_USERNAME", "user");
//define("DOMPDF_ADMIN_PASSWORD", "password");

You don't need to edit any of the settings to start using dompdf. All of the settings have defaults, and dompdf may work right out of the box. All the settings are explained in dompdf_config.inc.php, and this is also where the defaults are set. But here's a quick list of the setting to pay the most attention to:

  • DOMPDF_TEMP_DIR : dompdf uses this directory for image handling and temporary storage of remote content. The process under which dompdf is running should have read/write access. Default = sys_get_temp_dir()
  • DOMPDF_CHROOT : If you're using $dompdf->load_html_file() to load a file from the local file system it needs to be under the directory specified in this setting. Default = dompdf installation directory
  • DOMPDF_UNICODE_ENABLED : Does your document use a language other than English? If so this should be true, and you should read the Unicode How-to. Default = true.
  • DOMPDF_ENABLE_PHP : using inline script? If not or if you don't know what that means set this to false. Default = false.
  • DOMPDF_ENABLE_REMOTE : Are you loading documents using a full URL with domain? Do you reference images/stylesheets using a full URL with domain? Set this to true. Default = false.

And the config: (dompdf_config.custom.inc)

//define("DOMPDF_TEMP_DIR", "/tmp");
//define("DOMPDF_CHROOT", DOMPDF_DIR);
define("DOMPDF_UNICODE_ENABLED", true);
//define("DOMPDF_PDF_BACKEND", "PDFLib");
define("DOMPDF_DEFAULT_MEDIA_TYPE", "print");
define("DOMPDF_DEFAULT_PAPER_SIZE", "A4");
//define("DOMPDF_DEFAULT_FONT", "serif");
define("DOMPDF_DPI", 300);
define("DOMPDF_ENABLE_PHP", true);
define("DOMPDF_ENABLE_REMOTE", true);
define("DOMPDF_ENABLE_CSS_FLOAT", true);
//define("DOMPDF_ENABLE_JAVASCRIPT", false);
//define("DEBUGPNG", true);
//define("DEBUGKEEPTEMP", true);
//define("DEBUGCSS", true);
//define("DEBUG_LAYOUT", true);
//define("DEBUG_LAYOUT_LINES", false);
//define("DEBUG_LAYOUT_BLOCKS", false);
//define("DEBUG_LAYOUT_INLINE", false);
//define("DOMPDF_FONT_HEIGHT_RATIO", 1.0);
//define("DEBUG_LAYOUT_PADDINGBOX", false);
//define("DOMPDF_LOG_OUTPUT_FILE", DOMPDF_FONT_DIR."log.htm");
define("DOMPDF_ENABLE_HTML5PARSER", true);
define("DOMPDF_ENABLE_FONTSUBSETTING", true);

// DOMPDF authentication
define("DOMPDF_ADMIN_USERNAME", "admin");
define("DOMPDF_ADMIN_PASSWORD", "anypassword");