'); date_default_timezone_set('Europe/London'); include "05featuredemo.inc.php"; /** Include PHPExcel */ require_once dirname(__FILE__) . '/../src/Bootstrap.php'; // Change these values to select the Rendering library that you wish to use // and its directory location on your server //$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 = '/php/libraries/PDF/' . $rendererLibrary; echo date('H:i:s') , " Hide grid lines" , EOL; $objPHPExcel->getActiveSheet()->setShowGridLines(false); echo date('H:i:s') , " Set orientation to landscape" , EOL; $objPHPExcel->getActiveSheet()->getPageSetup()->setOrientation(\PHPExcel\Worksheet\PageSetup::ORIENTATION_LANDSCAPE); echo date('H:i:s') , " Write to PDF format using {$rendererName}" , EOL; if (!\PHPExcel\Settings::setPdfRenderer( $rendererName, $rendererLibraryPath )) { die( 'NOTICE: Please set the $rendererName and $rendererLibraryPath values' . EOL . 'at the top of this script as appropriate for your directory structure' ); } $callStartTime = microtime(true); $objWriter = \PHPExcel\IOFactory::createWriter($objPHPExcel, 'PDF'); $objWriter->setSheetIndex(0); $objWriter->save(str_replace('.php', '_'.$rendererName.'.pdf', __FILE__)); $callEndTime = microtime(true); $callTime = $callEndTime - $callStartTime; echo date('H:i:s') , " File written to " , str_replace('.php', '_'.$rendererName.'.pdf', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL; echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL; // Echo memory usage echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL; // Echo memory peak usage echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL; // Echo done echo date('H:i:s') , " Done writing files" , EOL; echo 'File has been created in ' , getcwd() , EOL;