我试图将excel文件另存为PDF,但是不断收到错误消息
致命错误:未捕获PHPExcel_Writer_Exception:PDF渲染库 尚未定义。在 C:\ xampp \ htdocs \ excelpdf \ vendor \ phpoffice \ phpexcel \ Classes \ PHPExcel \ Writer \ PDF.php:48 堆栈跟踪:#0 C:\ xampp \ htdocs \ excelpdf \ vendor \ phpoffice \ phpexcel \ Classes \ PHPExcel \ IOFactory.php(139): PHPExcel_Writer_PDF-> __ construct(Object(PHPExcel))#1 C:\ xampp \ htdocs \ excelpdf \ pdf.php(20): PHPExcel_IOFactory :: createWriter(Object(PHPExcel),'PDF')#2 {main} 扔进去 C:\ xampp \ htdocs \ excelpdf \ vendor \ phpoffice \ phpexcel \ Classes \ PHPExcel \ Writer \ PDF.php 在第48行
<?php
require "vendor/autoload.php";
$filename = "phpzag.xls";
$rendererName = PHPExcel_Settings::PDF_RENDERER_TCPDF;
//$rendererName = PHPExcel_Settings::PDF_RENDERER_MPDF;
//$rendererName = PHPExcel_Settings::PDF_RENDERER_DOMPDF;
$rendererLibrary = 'tcPDF5.9';
//$rendererLibrary = 'mPDF5.4';
//$rendererLibrary = 'domPDF0.6.0beta3';
$rendererLibraryPath = dirname(__FILE__).'/../../../tcpdf';
$objPHPexcel = new PHPExcel();
$excelReader = PHPExcel_IOFactory::createReaderForFile($filename);
$objPHPexcel = PHPExcel_IOFactory::load($filename);
$objWriter = PHPExcel_IOFactory::createWriter($objPHPexcel, 'PDF');
$objWriter->writeAllSheets();
$objWriter->save('write.pdf');
echo date('H:i:s')."Peak memory usage: ".(memory_get_peak_usage(true)/1024/1024) . " MBrn";
echo date('H:i:s')."Done writing files.rn";
?>