无法加载PDF渲染库phpExcel

时间:2017-06-13 06:34:10

标签: php codeigniter pdf phpexcel

我需要在php(codeigniter)中将xlsx文件转换为pdf

我正在使用外部库phpExcel和mpdf。

以下是我的代码

  $import_file = './Files/test.xlsx';

$sheet_name = 'PG_ONE';

$rendererName = PHPExcel_Settings::PDF_RENDERER_MPDF;

$rendererLibraryPath = '/usr/local/ampps/www/proj/application/libraries/M_pdf';

$object = PHPExcel_IOFactory::load($import_file);

$object->setActiveSheetIndexByName($sheet_name);

PHPExcel_Settings::setPdfRenderer($rendererName, $rendererLibraryPath);

$objWriter = PHPExcel_IOFactory::createWriter($object, 'PDF');

header('Content-Type: application/pdf');
header('Content-Disposition: attachment;filename="' . $export_file . '"');
header('Cache-Control: max-age=0');

$objWriter->save('php://output');

我收到以下错误:

  

输入:PHPExcel_Writer_Exception

     

消息:无法加载PDF呈现库

     

文件名:   /usr/local/ampps/www/proj/application/third_party/PHPExcel/Writer/PDF/mPDF.php

     

行号:8

我在哪里可以找到pdf渲染库我应该如何安装它??

0 个答案:

没有答案