New with PDF

Topics: Developer Forum, Project Management Forum, User Forum
Apr 19, 2010 at 5:39 PM
Edited Apr 19, 2010 at 6: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 8:25 PM

Never mind, i solved the problem!

 

Thanks!

Developer
Apr 19, 2010 at 8:47 PM
Edited Apr 19, 2010 at 8:48 PM

If you download the latest source code from here
http://phpexcel.codeplex.com/SourceControl/list/changesets

You will find
Tests/01simple-download-pdf.php

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');
$objWriter->save('php://output');
exit;