Problem to save at PDF format

Topics: Developer Forum
Jan 8, 2013 at 1:23 PM

Hi,

I am using PHPExcel to export to excel and PDF. The excel format havent problem, but when i try to export to PDF, i get the next error:

PDF Rendering library has not been defined

I am using this code:

require('./phpexcel/Classes/PHPExcel.php');

$objPHPExcel = new PHPExcel;

$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, "PDF");

$objSheet = $objPHPExcel->getActiveSheet();

$objSheet->setTitle('My sales report');

$objSheet->getStyle('A1:D1')->getFont()->setBold(true)->setSize(12);

$objSheet->getCell('A1')->setValue('Product');

$objSheet->getCell('B1')->setValue('Quanity');

$objSheet->getCell('C1')->setValue('Price');

$objSheet->getCell('D1')->setValue('Total Price');

$objWriter->save('test.pdf');

 

Could i can do?

Thank

Coordinator
Jan 9, 2013 at 6:45 AM

You need to tell PHPExcel what PDF rendering library you are using, either tcPDF, mPDF or DomPDF.... and this needs to be installed separately. Look at the examples to see how it should be defined for PHPExcel