note 25285 deleted from ref.pdf by nlopess
| From: | nlopess@php.net | Date: | Tue, 11 May 2004 13:19:48 +0000 |
| Subject: | note 25285 deleted from ref.pdf by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-69454@lists.php.net to get a copy of this message | ||
Note Submitter: frederic.surleau@atosorigin.com
----
If you use session, all headers you can send about "cache" are too late !
See http://bugs.php.net/?id=19450&edit=2
The solution is something like this :
<?php
// Default is "no-cache"
session_cache_limiter('private');
session_start();
$pdf = pdf_new();
/* your code here */
pdf_close($pdf);
$buf = pdf_get_buffer($pdf);
$len = strlen($buf);
header("Content-type: application/pdf");
header("Content-Length: $len");
header("Content-Disposition: inline; filename=foo.pdf");
print $buf;
pdf_delete($pdf);
?>