Is there a way to download pptx file with PHPPresentation?

947 Views Asked by At

I am using PHPPresentation for the first time and everything works fine, but I don't want to save file to some destination, I want to download that file through web browser. How to do that?

Please help.

This is code to save file on some destination

$oWriterPPTX = IOFactory::createWriter($objPHPPresentation, 'PowerPoint2007');
$oWriterPPTX->save(__DIR__ . "/sample.pptx");
2

There are 2 best solutions below

2
On BEST ANSWER

Try this code

 header("Content-Type: application/vnd.openxmlformats-officedocument.presentationml.presentation");
    header("Content-Disposition: attachment; filename=test.pptx");
    $oWriterPPTX = IOFactory::createWriter($this->objPhpPresentation,'PowerPoint2007' );
    $oWriterPPTX->save('php://output');
0
On

PHPPresentation should work similiar to PHPExcel.

According to this question you can use:

$oWriterPPTX->save('php://output');