New with PDF

Topics: Developer Forum, Project Management Forum, User Forum
Apr 19, 2010 at 6:39 PM
Edited Apr 19, 2010 at 7:43 PM

Hi guys,


I have a full application with PHPExcel working perfectly, but now i need convert this to PDF, i read thats possible with PHPExel but i didnt find a sample to how to do this, can someone show a sample with 01simple-download-xls converted to PDF?

Edit: And id like the PDF open in a browser, if im not mistaken the sample 21pdf.php save the file in the disk. (Redirect output to a client’s web browser) How to do that?

Thanks a lot guys!

Apr 19, 2010 at 9:25 PM

Never mind, i solved the problem!



Apr 19, 2010 at 9:47 PM
Edited Apr 19, 2010 at 9:48 PM

If you download the latest source code from here

You will find

The example will be included for the next release PHPExcel 1.7.3


// Redirect output to a client’s web browser (Excel2007)
header('Content-Type: application/pdf');
header('Content-Disposition: attachment;filename="01simple.pdf"');
header('Cache-Control: max-age=0');

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