'); date_default_timezone_set('Europe/London'); include "05featuredemo.inc.php"; /** PHPExcel_IOFactory */ require_once '../Classes/PHPExcel/IOFactory.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_MPDF; $rendererName = PHPExcel_Settings::PDF_RENDERER_DOMPDF; //$rendererLibrary = 'tcPDF5.9'; //$rendererLibrary = 'mPDF5.4'; $rendererLibrary = 'domPDF0.6.0beta3'; $rendererLibraryPath = dirname(__FILE__).'/../../../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' ); } $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'PDF'); $objWriter->setSheetIndex(0); $objWriter->save(str_replace('.php', '_'.$rendererName.'.pdf', __FILE__)); echo date('H:i:s') , " File written to " , str_replace('.php', '_'.$rendererName.'.pdf', pathinfo(__FILE__, PATHINFO_BASENAME)) , 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;