note 10557 added to PDF functions
| From: | boism at NOSPAMmultimania dot com | Date: | Wed, 10 Jan 2001 10:40:58 +0000 |
| Subject: | note 10557 added to PDF functions | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-9558@lists.php.net to get a copy of this message | ||
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);
?>
http://www.php.net/manual/ref.pdf.php