xls -> pdf : Scale to Fit doesn't work

Topics: Developer Forum, User Forum
Feb 4, 2015 at 10:39 AM
Hi,

I've been using the 26tf8.php example in order to load an Excel template file to transform to PDF (the site is joomla).
The process itself works fine but the output scale width isn't applied (I'd like to scale to 1 page wide).
Pease help !! Did i forgot something?
thanks

Here is the code :

$rendererName = PHPExcel_Settings::PDF_RENDERER_DOMPDF;
$rendererLibrary = '/dompdf';
$rendererLibraryPath = JPATH_LIBRARIES . $rendererLibrary;

$objReader = PHPExcel_IOFactory::createReader('Excel2007');
$objPHPExcel = $objReader->load($inputFileName);

$objPHPExcel->getActiveSheet()->getPageSetup()->setFitToWidth(1);
$objPHPExcel->getActiveSheet()->getPageSetup()->setFitToHeight(1);

$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'PDF');
$objWriter->save(str_replace('.php', '.pdf', FILE));