Displaying a pdf inline
| From: | Todd Cary | Date: | Wed, 15 Sep 2004 02:47:25 +0000 |
| Subject: | Displaying a pdf inline | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-196682@lists.php.net to get a copy of this message | ||
After reading the online documentation, it appears that I should be using the following code, however it does not appear to work. Are there some obvious errors?
if ($row) {
$pdf_file = $row->CLM_IMG_FILE;
$msg = $pdf_file;
$SRC_FILE = "/tmp/" . $pdf_file;
$download_size = filesize($SRC_FILE);
$filename = basename($SRC_FILE);
//print("Filename: " . $filename . "<br>");
//print("SRC_FILE: " . $SRC_FILE . "<br>");
//print("Size: " . $download_size . "<br>");
header("Content-Type: application/pdf");
header("Content-Disposition: inline; filename=image.pdf");
//header("Content-Disposition: attachment; filename=image.pdf");
header("Content-Length: $download_size");
header("Connection: close");
readfile($SRC_FILE);
} else {
$msg = "Cannot find the claim";
}
Todd