如何将渲染器名称和渲染器路径库文件设置为PHPExcel?

时间:2015-02-28 12:10:37

标签: php phpexcel

如何将渲染器名称和渲染器路径库文件设置为PHPExcel?

我尝试将渲染器路径和库文件设置为01simple-download-pdf.php,但我收到以下错误:

Notice: Use of undefined constant FILE - assumed 'FILE' in C:\xampp\htdocs\crm\sample\PHPExcel-develop\Examples\01simple-download-pdf.php on line 64
NOTICE: Please set the $rendererName and $rendererLibraryPath values
at the top of this script as appropriate for your directory structure

1 个答案:

答案 0 :(得分:1)

首先,您应该选择并安装第三方PDF渲染库。例如:tcPDF,mPDF,DomPDF。

接下来,您必须告诉PHPExcel您选择的库及其所在位置:

$rendererName = PHPExcel_Settings::PDF_RENDERER_DOMPDF;
$rendererLibrary = 'dompdf_0-6-0_beta3';
$rendererLibraryPath = dirname(__FILE__).'/'. $rendererLibrary;

(假设你选择了DomPDF,包含它的文件夹是dompdf_0-6-0_beta3

您可以阅读更多How to configure phpexcel for pdf