Mpdf 如何在 .module 文件中添加依赖项

Mpdf how to add dependency in a .module file

Drupal 7

我正在尝试通过 mpdf 生成 Pdf 那么如何执行此事件以及如何添加依赖项 ..

我正在使用的代码

require_once __DIR__。 '/vendor/autoload.php'; //应该加什么

$html = '
<h1><a name="top"></a>mPDF</h1>
<h2>Basic HTML Example</h2>
This file demonstrates most of the HTML elements.

<h5>Heading 5</h5>
<h6>Heading 6</h6>
';

$mpdf=new Mpdf;
$mpdf->WriteHTML($html);
$mpdf->Output();

这是我收到的错误

您需要在您的 Drupal 站点上添加 mPDF 库

首先,您已经从下面URL (http://www.mpdf1.com/mpdf/index.php)下载了mPDF包 他们将文件夹解压缩到 /sites/all/libraries 路径

注意:无需添加代码来包含 mPDF 的自动加载文件,它将默认从库文件夹中添加

此外,您会发现 Drupal 的 mPDF 模块,在这里您将有更多选择来减少您的时间

模块路径:https://www.drupal.org/project/pdf_using_mpdf