Printing Drupal 7:使用dompdf打印pdf

Printing Drupal 7:使用dompdf打印pdf,printing,drupal-7,dompdf,Printing,Drupal 7,Dompdf,我需要安装dompdf的帮助。我应该将解压缩的zip文件放在目录中的什么位置?我遵循INSTALL.txt,它说“将下载包的内容提取到支持的路径之一。”这是否意味着将其放入“Modules”文件夹?如果是,则请求“.info”时出错。而且它没有供应。请帮帮我,我糊涂了!谢谢 install.txt文件中列出了支持的路径: supported paths: * print module lib directory (usually sites/all/modules/print/lib)

我需要安装dompdf的帮助。我应该将解压缩的zip文件放在目录中的什么位置?我遵循INSTALL.txt,它说“将下载包的内容提取到支持的路径之一。”这是否意味着将其放入“Modules”文件夹?如果是,则请求“.info”时出错。而且它没有供应。请帮帮我,我糊涂了!谢谢

install.txt文件中列出了支持的路径:

supported paths:
  * print module lib directory (usually sites/all/modules/print/lib)
  * libraries directory (sites/all/libraries)
我更喜欢第二个选项,它将使您不必在每次更新模块时都这样做

换句话说,它应该是这样的
sites/all/libraries/dompdf

下面是我加载它的方式

  • 我将文件夹dompdf-0.5.1移动到
    /sites/all/libraries
    文件夹
  • 我编辑了dompdf_config.inc.php,将
    dompdf_autoload()
    函数替换为:
代码:

  • 现在,您应该能够在任何其他模块中像这样使用它
代码:

这很有效,我能够使用DOMPDF对象/类

function DOMPDF_autoload($class) {
  /* Add this checking - START */
  if (mb_strtolower($class)== 'firephp'){
    return;
  }
  /* Add this checking - END */

  $filename = mb_strtolower($class) . ".cls.php";
  require_once(DOMPDF_INC_DIR . "/$filename");
}
if ( !function_exists("__autoload") ) {
  /**
   * Default __autoload() function
   *
   * @param string $class
   */
  function __autoload($class) {
    DOMPDF_autoload($class);
  }
}
    require_once(realpath('.')."/sites/all/libraries/dompdf-0.5.1/dompdf_config.inc.php");
    spl_autoload_register('DOMPDF_autoload'); 

    $obj = new DOMPDF();