我使用PHPExcel生成模板,然后我希望使用Mpdf将其转换为PDF文件。我使用PHPExcel 1.7.8和Mpdf 6.0
但问题在于
我的代码
$rendererName = PHPExcel_Settings::PDF_RENDERER_MPDF;
$rendererLibrary = 'mpdf';
$rendererLibraryPath = APPPATH.'plugins/' .
$rendererLibrary;
if (!PHPExcel_Settings::setPdfRenderer(
$rendererName,
$rendererLibraryPath
)) {
die(
'Please set the $rendererName and $rendererLibraryPath values' .
PHP_EOL .
' as appropriate for your directory structure'
); }
$filename = "DWG Register.pdf"; //save workbook to a file name
header('Content-Type: application/pdf'); //mime type
header('Content-Disposition: attachement;filename="'.$filename.'"'); //tell browser what's the file name
header('Cache-Control: max-age=0'); //no cache
$objWriter = PHPExcel_IOFactory::createWriter($this->excel, 'PDF');
$objWriter->setSheetIndex(0);
$objWriter->save('php://output');
exit;