note 10557 deleted from ref.pdf by didou
| From: | didou@php.net | Date: | Fri, 08 Aug 2003 21:59:09 +0000 |
| Subject: | note 10557 deleted from ref.pdf by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-53709@lists.php.net to get a copy of this message | ||
Note Submitter: boism@NOSPAMmultimania.com
----
Here is a short example to display PDF files without needing a 'redirection'.
Works also with IE thanks to the previous note.
Avoid spaces/newlines/whatever before and after the php script if you want the file to be correctly
handled as PDF.
Mathieu BOIS
pdftest.php :
<?php
$filename="/tmp/test.pdf";
$fp=fopen($filename,"w");
//CREATE YOUR PDF FILE HERE
fclose($fp);
$fp2=fopen($filename,"r");
header("Content-Length: ".filesize($filename)); // for IE to work
header("Content-type: application/pdf");
fpassthru($fp2);
fclose($fp2);
?>