Forum


Replies: 4   Views: 3176
Convert to pdf and view it in the browser instead of download
Topic closed:
Please note this is an old forum thread. Information in this post may be out-to-date and/or erroneous.
Every phpdocx version includes new features and improvements. Previously unsupported features may have been added to newer releases, or past issues may have been corrected.
We encourage you to download the current phpdocx version and check the Documentation available.

Posted by davelavinsky  · 04-11-2016 - 16:18

I'm concerned if people don't have Adobe on their computers. I think they are very, very likely to have the Adobe web plugin that allows them to see PDF files in their browser. So, is it possible to code it so that the PDF file opens in a new window in their web browser?

Right now, I have this which downloads.

$docx->enableCompatibilityMode();
$docx->createDocx("temp/".$ID);
$docx->transformDocument("temp/$ID.docx", "temp/$ID.pdf");

header('Content-type:application/pdf');
header('Content-Disposition:attachment;filename="'.$bp->Name.'.pdf"');
readfile("temp/$ID.pdf");